Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ jobs:
matrix:
os: [ubuntu-latest]
php: ['8.2', '8.3', '8.4']
laravel: ['11.*', '12.*']
stability: [prefer-lowest, prefer-stable]
laravel: ['12.*', '13.*']
include:
- laravel: 11.*
testbench: 9.*
- laravel: 12.*
testbench: ^10.0
- laravel: 13.*
testbench: ^11.0
exclude:
- laravel: 13.*
php: '8.2'

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.os }}

steps:
- name: Checkout code
Expand All @@ -43,7 +45,7 @@ jobs:
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
composer update --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/phpunit --colors=always
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.2",
"ext-json": "*",
"illuminate/console": "^11.0 | ^12.0",
"illuminate/database": "^11.0 | ^12.0",
"illuminate/events": "^11.0 | ^12.0",
"illuminate/support": "^11.0 | ^12.0",
"illuminate/console": "^12.0 | ^13.0",
"illuminate/database": "^12.0 | ^13.0",
"illuminate/events": "^12.0 | ^13.0",
"illuminate/support": "^12.0 | ^13.0",
"spatie/yaml-front-matter": "^2.0",
"symfony/yaml": "^6.0 | ^7.0"
},
"require-dev": {
"laravel/scout": "^9.4 | ^10.0",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^9.0 | ^10.0",
"laravel/scout": "^10.0 | ^11.0",
"nunomaduro/larastan": "^3.0",
"orchestra/testbench": "^10.0 | ^11.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0 | ^2.0",
"phpstan/phpstan-phpunit": "^1.0 | ^2.0",
"phpunit/phpunit": "^10.0 | ^11.5.3"
"phpunit/phpunit": "^11.5.3"
},
"extra": {
"laravel": {
Expand Down
2 changes: 0 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ parameters:
level: 5
paths:
- src
- config
tmpDir: build/phpstan
checkOctaneCompatibility: true
checkModelProperties: true
checkMissingIterableValueType: false
6 changes: 5 additions & 1 deletion src/Commands/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Schema\ColumnDefinition;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;

class GenerateCommand extends Command
Expand Down Expand Up @@ -41,7 +42,10 @@ public function handle()

protected function getColumnsFromModel(string $modelClass): Collection
{
$blueprint = new Blueprint('__orbit:generate__');
$blueprint = new Blueprint(
DB::connection('orbit'),
Str::snake(Str::pluralStudly(class_basename($modelClass))),
);

/**
* @psalm-suppress InvalidStringClass
Expand Down
7 changes: 5 additions & 2 deletions src/Concerns/Orbital.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Orbit\Support;
use ReflectionClass;

// @phpstan-ignore trait.unused
trait Orbital
{
protected static $orbit;
Expand All @@ -31,13 +32,15 @@ public static function bootOrbital()
$driver = Orbit::driver(static::getOrbitalDriver());
$modelFile = (new ReflectionClass(static::class))->getFileName();

$instance = (new ReflectionClass(static::class))->newInstanceWithoutConstructor();

if (
Orbit::isTesting() ||
filemtime($modelFile) > filemtime(Orbit::getDatabasePath()) ||
$driver->shouldRestoreCache(static::getOrbitalPath()) ||
! static::resolveConnection()->getSchemaBuilder()->hasTable((new static())->getTable())
! static::resolveConnection()->getSchemaBuilder()->hasTable($instance->getTable())
) {
(new static())->migrate();
$instance->migrate();
}

static::created(function (Model $model) {
Expand Down
1 change: 1 addition & 0 deletions src/Concerns/SoftDeletes.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Orbit\Events\OrbitalUpdated;
use Orbit\Facades\Orbit;

// @phpstan-ignore trait.unused
trait SoftDeletes
{
use EloquentSoftDeletes;
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ protected function getPackageProviders($app)
];
}

public function getEnvironmentSetUp($app)
public function defineEnvironment($app)
{
$app['config']->set('database.default', 'sqlite');
$app['config']->set('database.connections.sqlite.database', ':memory:');
Expand Down
Loading