diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 67e66c6..2cb1d5e 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v2.0.0 + uses: dependabot/fetch-metadata@v2.3.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml index 46308bc..7eb9e9e 100644 --- a/.github/workflows/fix-php-code-style-issues.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -13,7 +13,7 @@ jobs: ref: ${{ github.head_ref }} - name: Fix PHP code style issues - uses: aglipanci/laravel-pint-action@2.3.1 + uses: aglipanci/laravel-pint-action@2.5 - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v5 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 07c5f55..74e772c 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -19,20 +19,20 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest, windows-latest] - php: [8.1, 8.2] - laravel: [9.*, 10.*, 11.*] + php: [8.1, 8.2, 8.3] + laravel: [10.*, 11.*, 12.*] stability: [prefer-lowest, prefer-stable] include: - - laravel: 9.* - testbench: 7.* - laravel: 10.* testbench: 8.* - laravel: 11.* testbench: 9.* + - laravel: 12.* + testbench: 10.* exclude: - - laravel: 9.* - php: 8.2 - - larvel: 11.* + - laravel: 11.* + php: 8.1 + - laravel: 12.* php: 8.1 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/composer.json b/composer.json index 0e52df4..79a0117 100644 --- a/composer.json +++ b/composer.json @@ -18,19 +18,19 @@ "require": { "php": "^8.1", "spatie/laravel-package-tools": "^1.13.0", - "illuminate/contracts": "^9.0|^10.0|^11.0" + "illuminate/contracts": "^9.0|^10.0|^11.0|^12.0" }, "require-dev": { "laravel/pint": "^1.0", "nunomaduro/collision": "^6.0|^7.0|^8.0", - "nunomaduro/larastan": "^2.0.1", - "orchestra/testbench": "^7.0|^8.0|^9.0", - "pestphp/pest": "^1.21", - "pestphp/pest-plugin-laravel": "^1.1", + "nunomaduro/larastan": "^2.0.1|^3.0", + "orchestra/testbench": "^7.0|^8.0|^9.0|^10.0", + "phpunit/phpunit": "^9.5|^10.0|^11.0", + "pestphp/pest": "^1.21|^2.0|^3.7", + "pestphp/pest-plugin-arch": "^2.0|^3.0", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5|^10.0|^11.0" + "phpstan/phpstan-deprecation-rules": "^1.0|^2.0", + "phpstan/phpstan-phpunit": "^1.0|^2.0" }, "autoload": { "psr-4": { diff --git a/config/laravel_ticket.php b/config/laravel_ticket.php index 429083e..2c2dfc8 100644 --- a/config/laravel_ticket.php +++ b/config/laravel_ticket.php @@ -73,5 +73,13 @@ ], ], ], - + /** + * Models for Eloquent relationships + */ + 'models' => [ + 'ticket' => \Coderflex\LaravelTicket\Models\Ticket::class, + 'message' => \Coderflex\LaravelTicket\Models\Message::class, + 'category' => \Coderflex\LaravelTicket\Models\Category::class, + 'label' => \Coderflex\LaravelTicket\Models\Label::class, + ], ]; diff --git a/src/Models/Category.php b/src/Models/Category.php index 908f072..e3ed79f 100644 --- a/src/Models/Category.php +++ b/src/Models/Category.php @@ -24,7 +24,7 @@ class Category extends Model */ public function tickets(): BelongsToMany { - return $this->belongsToMany(Ticket::class); + return $this->belongsToMany(config('laravel_ticket.models.ticket')); } /** diff --git a/src/Models/Label.php b/src/Models/Label.php index c8357c5..1446eb2 100644 --- a/src/Models/Label.php +++ b/src/Models/Label.php @@ -24,7 +24,7 @@ class Label extends Model */ public function tickets(): BelongsToMany { - return $this->belongsToMany(Ticket::class); + return $this->belongsToMany(config('laravel_ticket.models.ticket')); } /** diff --git a/src/Models/Message.php b/src/Models/Message.php index 7b62db1..61e65f6 100644 --- a/src/Models/Message.php +++ b/src/Models/Message.php @@ -31,7 +31,7 @@ public function ticket(): BelongsTo $tableName = config('laravel_ticket.table_names.messages', 'messages'); return $this->belongsTo( - Ticket::class, + config('laravel_ticket.models.ticket'), $tableName['columns']['ticket_foreign_id'] ); } diff --git a/src/Models/Ticket.php b/src/Models/Ticket.php index 316c76f..06a9aea 100644 --- a/src/Models/Ticket.php +++ b/src/Models/Ticket.php @@ -61,7 +61,7 @@ public function messages(): HasMany $tableName = config('laravel_ticket.table_names.messages', 'messages'); return $this->hasMany( - Message::class, + config('laravel_ticket.models.message'), (string) $tableName['columns']['ticket_foreign_id'], ); } @@ -74,7 +74,7 @@ public function categories(): BelongsToMany $table = config('laravel_ticket.table_names.category_ticket', 'category_ticket'); return $this->belongsToMany( - Category::class, + config('laravel_ticket.models.category'), $table['table'], $table['columns']['ticket_foreign_id'], $table['columns']['category_foreign_id'], @@ -89,7 +89,7 @@ public function labels(): BelongsToMany $table = config('laravel_ticket.table_names.label_ticket', 'label_ticket'); return $this->belongsToMany( - Label::class, + config('laravel_ticket.models.label'), $table['table'], $table['columns']['ticket_foreign_id'], $table['columns']['label_foreign_id'], @@ -104,7 +104,7 @@ public function labels(): BelongsToMany public function getTable() { return config( - 'laravel_ticket.table_names.tickets', + 'laravel_ticket.models.tickets', parent::getTable() ); } diff --git a/tests/Database/Migrations/create_users_table.php b/tests/Database/Migrations/create_users_table.php index 57f0097..d52f72d 100644 --- a/tests/Database/Migrations/create_users_table.php +++ b/tests/Database/Migrations/create_users_table.php @@ -4,7 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class() extends Migration +return new class extends Migration { public function up() {