Skip to content

Commit 551aab3

Browse files
committed
wip
1 parent 3084b4e commit 551aab3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+996
-880
lines changed

.github/workflows/pint.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Code Style (Pint)
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
pint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
with:
17+
token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: 8.3
23+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
24+
coverage: none
25+
26+
- name: Cache Composer packages
27+
id: composer-cache
28+
uses: actions/cache@v3
29+
with:
30+
path: vendor
31+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
32+
restore-keys: |
33+
${{ runner.os }}-php-
34+
35+
- name: Install dependencies
36+
run: composer install --prefer-dist --no-progress
37+
38+
- name: Run Pint
39+
run: ./vendor/bin/pint
40+
41+
- name: Commit changes
42+
uses: stefanzweifel/git-auto-commit-action@v5
43+
if: github.event_name == 'push'
44+
with:
45+
commit_message: 'fix: code style fixes by Pint'
46+
commit_user_name: 'github-actions[bot]'
47+
commit_user_email: 'github-actions[bot]@users.noreply.github.com'

.github/workflows/tests.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: true
15+
matrix:
16+
php: [8.3]
17+
laravel: [10.*, 11.*]
18+
dependency-version: [prefer-stable]
19+
20+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php }}
30+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
31+
coverage: none
32+
33+
- name: Setup problem matchers
34+
run: |
35+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
36+
37+
- name: Install dependencies
38+
run: |
39+
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
40+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
41+
42+
- name: List Installed Dependencies
43+
run: composer show -D
44+
45+
- name: Execute tests
46+
run: vendor/bin/pest

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,20 @@ Homestead.json
2929
.phpactor.json
3030
auth.json
3131

32+
# IDE files
33+
.vscode/
34+
.idea/
35+
*.swp
36+
*.swo
37+
38+
# OS files
39+
.DS_Store
40+
Thumbs.db
41+
42+
# Temporary files
43+
*.tmp
44+
*.bak
45+
46+
# Package development
47+
composer.phar
3248
.kiro/

.vscode/settings.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Laravel Dynamic Properties
22

3+
[![Tests](https://github.com/solutionforest/laravel-dynamic-properties/workflows/Tests/badge.svg)](https://github.com/solutionforest/laravel-dynamic-properties/actions)
4+
[![Code Style](https://github.com/solutionforest/laravel-dynamic-properties/workflows/Code%20Style%20(Pint)/badge.svg)](https://github.com/solutionforest/laravel-dynamic-properties/actions)
5+
[![Latest Stable Version](https://poser.pugx.org/solution-forest/laravel-dynamic-properties/v/stable)](https://packagist.org/packages/solution-forest/laravel-dynamic-properties)
6+
[![License](https://poser.pugx.org/solution-forest/laravel-dynamic-properties/license)](https://packagist.org/packages/solution-forest/laravel-dynamic-properties)
7+
38
A HubSpot-like dynamic property system for Laravel that allows any entity (users, companies, contacts, etc.) to have custom properties with validation, search capabilities, and optimal performance.
49

510
## Features
@@ -17,20 +22,20 @@ A HubSpot-like dynamic property system for Laravel that allows any entity (users
1722
Install the package via Composer:
1823

1924
```bash
20-
composer require your-vendor/laravel-dynamic-properties
25+
composer require solution-forest/laravel-dynamic-properties
2126
```
2227

2328
Publish and run the migrations:
2429

2530
```bash
26-
php artisan vendor:publish --provider="YourVendor\DynamicProperties\DynamicPropertyServiceProvider" --tag="migrations"
31+
php artisan vendor:publish --provider="SolutionForest\LaravelDynamicProperties\DynamicPropertyServiceProvider" --tag="migrations"
2732
php artisan migrate
2833
```
2934

3035
Optionally, publish the configuration file:
3136

3237
```bash
33-
php artisan vendor:publish --provider="YourVendor\DynamicProperties\DynamicPropertyServiceProvider" --tag="config"
38+
php artisan vendor:publish --provider="SolutionForest\LaravelDynamicProperties\DynamicPropertyServiceProvider" --tag="config"
3439
```
3540

3641
## Quick Start
@@ -43,7 +48,7 @@ php artisan vendor:publish --provider="YourVendor\DynamicProperties\DynamicPrope
4348
namespace App\Models;
4449

4550
use Illuminate\Database\Eloquent\Model;
46-
use YourVendor\DynamicProperties\Traits\HasProperties;
51+
use SolutionForest\LaravelDynamicProperties\Traits\HasProperties;
4752

4853
class User extends Model
4954
{

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
"license": "MIT",
66
"autoload": {
77
"psr-4": {
8-
"DynamicProperties\\": "src/"
8+
"SolutionForest\\LaravelDynamicProperties\\": "src/"
99
}
1010
},
1111
"autoload-dev": {
1212
"psr-4": {
13-
"DynamicProperties\\Tests\\": "tests/"
13+
"SolutionForest\\LaravelDynamicProperties\\Tests\\": "tests/"
1414
}
1515
},
1616
"require": {
@@ -26,10 +26,10 @@
2626
"extra": {
2727
"laravel": {
2828
"providers": [
29-
"DynamicProperties\\DynamicPropertyServiceProvider"
29+
"SolutionForest\\LaravelDynamicProperties\\DynamicPropertyServiceProvider"
3030
],
3131
"aliases": {
32-
"DynamicProperties": "DynamicProperties\\Facades\\DynamicProperties"
32+
"DynamicProperties": "SolutionForest\\LaravelDynamicProperties\\Facades\\DynamicProperties"
3333
}
3434
}
3535
},

composer.json.backup

Lines changed: 0 additions & 44 deletions
This file was deleted.

composer.phar

-2.97 MB
Binary file not shown.

config/dynamic-properties.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
*/
1212

1313
'defaults' => [
14-
'required' => false,
14+
'required' => false,
1515
'searchable' => true,
16-
'cacheable' => true,
16+
'cacheable' => true,
1717
],
1818

1919
/*
@@ -31,12 +31,12 @@
3131

3232
// Database-specific optimizations
3333
'mysql' => [
34-
'use_json_functions' => true,
34+
'use_json_functions' => true,
3535
'enable_fulltext_search' => true,
3636
],
3737

3838
'sqlite' => [
39-
'use_json1_extension' => true,
39+
'use_json1_extension' => true,
4040
'fallback_to_like_search' => true,
4141
],
4242
],

database/migrations/2024_01_01_000004_add_database_specific_optimizations.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
use DynamicProperties\Services\DatabaseCompatibilityService;
43
use Illuminate\Database\Migrations\Migration;
54
use Illuminate\Support\Facades\DB;
5+
use SolutionForest\LaravelDynamicProperties\Services\DatabaseCompatibilityService;
66

77
return new class extends Migration
88
{
@@ -19,10 +19,10 @@ public function up(): void
1919

2020
// Apply database-specific optimizations
2121
match ($driver) {
22-
'mysql' => $this->optimizeMySQL(),
22+
'mysql' => $this->optimizeMySQL(),
2323
'sqlite' => $this->optimizeSQLite(),
24-
'pgsql' => $this->optimizePostgreSQL(),
25-
default => null
24+
'pgsql' => $this->optimizePostgreSQL(),
25+
default => null
2626
};
2727
}
2828

@@ -32,10 +32,10 @@ public function down(): void
3232

3333
// Remove database-specific optimizations
3434
match ($driver) {
35-
'mysql' => $this->rollbackMySQL(),
35+
'mysql' => $this->rollbackMySQL(),
3636
'sqlite' => $this->rollbackSQLite(),
37-
'pgsql' => $this->rollbackPostgreSQL(),
38-
default => null
37+
'pgsql' => $this->rollbackPostgreSQL(),
38+
default => null
3939
};
4040
}
4141

@@ -192,10 +192,10 @@ protected function indexExists(string $table, string $index): bool
192192

193193
try {
194194
return match ($driver) {
195-
'mysql' => ! empty(DB::select("SHOW INDEX FROM {$table} WHERE Key_name = ?", [$index])),
195+
'mysql' => ! empty(DB::select("SHOW INDEX FROM {$table} WHERE Key_name = ?", [$index])),
196196
'sqlite' => ! empty(DB::select("SELECT name FROM sqlite_master WHERE type='index' AND name=?", [$index])),
197-
'pgsql' => ! empty(DB::select('SELECT indexname FROM pg_indexes WHERE tablename = ? AND indexname = ?', [$table, $index])),
198-
default => false
197+
'pgsql' => ! empty(DB::select('SELECT indexname FROM pg_indexes WHERE tablename = ? AND indexname = ?', [$table, $index])),
198+
default => false
199199
};
200200
} catch (\Exception $e) {
201201
return false;

0 commit comments

Comments
 (0)