From bfde97b52f6cdb96bb95016e7ba5c17ebd095c8a Mon Sep 17 00:00:00 2001 From: Jeremy Layson Date: Wed, 6 Mar 2024 06:21:52 +0800 Subject: [PATCH] Fix lint --- src/Commands/MakeUser.php | 8 ++++---- src/Models/AbstractContentResource.php | 1 - tests/Feature/MakeUserTest.php | 2 +- tests/Filament/AuthorResourceTest.php | 4 ++-- tests/Filament/PageResourceTest.php | 1 - tests/Filament/PermissionResourceTest.php | 1 - tests/Filament/RoleResourceTest.php | 1 - tests/Filament/TaxonomyResourceTest.php | 1 - tests/Filament/UserResourceTest.php | 3 +-- tests/TestCase.php | 3 +-- tests/User.php | 1 - workbench/database/seeders/DatabaseSeeder.php | 1 - 12 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/Commands/MakeUser.php b/src/Commands/MakeUser.php index ff3b8edc..dbc82404 100644 --- a/src/Commands/MakeUser.php +++ b/src/Commands/MakeUser.php @@ -28,9 +28,9 @@ public function handle() return false; } - + $userModelClass = config('auth.providers.users.model'); - $userModel = new $userModelClass; + $userModel = new $userModelClass(); $userFieldsRaw = Schema::getColumnListing($userModel->getTable()); $excludeFields = ['id', 'created_at', 'updated_at', 'deleted_at', 'remember_token', 'email_verified_at']; @@ -51,11 +51,11 @@ public function handle() if ($dryRun) { $this->info('User to be created'); $this->info($userModel); - return TRUE; + return true; } else { $this->info('User created'); $userModel->save(); - return TRUE; + return true; } } } diff --git a/src/Models/AbstractContentResource.php b/src/Models/AbstractContentResource.php index f1a22644..20c491b4 100644 --- a/src/Models/AbstractContentResource.php +++ b/src/Models/AbstractContentResource.php @@ -2,7 +2,6 @@ namespace Portable\FilaCms\Models; -use App\Models\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; diff --git a/tests/Feature/MakeUserTest.php b/tests/Feature/MakeUserTest.php index 403e4441..a308b862 100644 --- a/tests/Feature/MakeUserTest.php +++ b/tests/Feature/MakeUserTest.php @@ -35,7 +35,7 @@ public function test_roles_created(): void { $userModel = config('auth.providers.users.model'); - $userFieldsRaw = Schema::getColumnListing((new $userModel)->getTable()); + $userFieldsRaw = Schema::getColumnListing((new $userModel())->getTable()); $excludeFields = [ 'id', 'created_at', 'updated_at', 'deleted_at', 'remember_token', 'email_verified_at' ]; $userFields = array_diff($userFieldsRaw, $excludeFields); diff --git a/tests/Filament/AuthorResourceTest.php b/tests/Filament/AuthorResourceTest.php index a65f5127..111ddc3e 100644 --- a/tests/Filament/AuthorResourceTest.php +++ b/tests/Filament/AuthorResourceTest.php @@ -19,10 +19,10 @@ protected function setUp(): void $this->artisan('db:seed', ['--class' => '\\Portable\\FilaCms\\Database\\Seeders\\RoleAndPermissionSeeder']); $adminRole = Role::where('name', 'Admin')->first(); - + $userModel = config('auth.providers.users.model'); - $adminUser = (new $userModel)->create([ + $adminUser = (new $userModel())->create([ 'name' => 'Test', 'email' => 'test@example.com', 'password' => 'password' diff --git a/tests/Filament/PageResourceTest.php b/tests/Filament/PageResourceTest.php index b4e117c4..3aa14077 100644 --- a/tests/Filament/PageResourceTest.php +++ b/tests/Filament/PageResourceTest.php @@ -5,7 +5,6 @@ use Portable\FilaCms\Tests\TestCase; use Illuminate\Foundation\Testing\RefreshDatabase; use Portable\FilaCms\Filament\Resources\PageResource as TargetResource; -use Portable\FilaCms\Tests\User; use Portable\FilaCms\Models\Page as TargetModel; use Spatie\Permission\Models\Role; use Portable\FilaCms\Models\Author; diff --git a/tests/Filament/PermissionResourceTest.php b/tests/Filament/PermissionResourceTest.php index 3f49fa81..c42d6b5f 100644 --- a/tests/Filament/PermissionResourceTest.php +++ b/tests/Filament/PermissionResourceTest.php @@ -5,7 +5,6 @@ use Portable\FilaCms\Tests\TestCase; use Illuminate\Foundation\Testing\RefreshDatabase; use Portable\FilaCms\Filament\Resources\PermissionResource as TargetResource; -use Portable\FilaCms\Tests\User; use Spatie\Permission\Models\Permission as TargetModel; use Spatie\Permission\Models\Role; use Livewire\Livewire; diff --git a/tests/Filament/RoleResourceTest.php b/tests/Filament/RoleResourceTest.php index 7197b3e5..10dbee5c 100644 --- a/tests/Filament/RoleResourceTest.php +++ b/tests/Filament/RoleResourceTest.php @@ -5,7 +5,6 @@ use Portable\FilaCms\Tests\TestCase; use Illuminate\Foundation\Testing\RefreshDatabase; use Portable\FilaCms\Filament\Resources\RoleResource as TargetResource; -use Portable\FilaCms\Tests\User; use Spatie\Permission\Models\Role as TargetModel; use Spatie\Permission\Models\Role; use Livewire\Livewire; diff --git a/tests/Filament/TaxonomyResourceTest.php b/tests/Filament/TaxonomyResourceTest.php index 30e77c5c..30454b2a 100644 --- a/tests/Filament/TaxonomyResourceTest.php +++ b/tests/Filament/TaxonomyResourceTest.php @@ -5,7 +5,6 @@ use Portable\FilaCms\Tests\TestCase; use Illuminate\Foundation\Testing\RefreshDatabase; use Portable\FilaCms\Filament\Resources\TaxonomyResource as TargetResource; -use Portable\FilaCms\Tests\User; use Portable\FilaCms\Models\Taxonomy as TargetModel; use Spatie\Permission\Models\Role; use Livewire\Livewire; diff --git a/tests/Filament/UserResourceTest.php b/tests/Filament/UserResourceTest.php index bf63ec62..7c6a1cc3 100644 --- a/tests/Filament/UserResourceTest.php +++ b/tests/Filament/UserResourceTest.php @@ -5,7 +5,6 @@ use Portable\FilaCms\Tests\TestCase; use Illuminate\Foundation\Testing\RefreshDatabase; use Portable\FilaCms\Filament\Resources\UserResource; -use Portable\FilaCms\Tests\User; use Spatie\Permission\Models\Role; use Livewire\Livewire; @@ -41,7 +40,7 @@ public function test_can_list_users(): void { $users = []; - for ($i=0; $i < 5; $i++) { + for ($i = 0; $i < 5; $i++) { $users[] = $this->createUser(); } diff --git a/tests/TestCase.php b/tests/TestCase.php index 49860ccc..59570bd4 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -8,7 +8,6 @@ use Illuminate\Support\Facades\File; use Orchestra\Testbench\Attributes\WithMigration; use Orchestra\Testbench\Concerns\WithWorkbench; -use Portable\FilaCms\Tests\User; #[WithMigration] abstract class TestCase extends \Orchestra\Testbench\TestCase @@ -60,7 +59,7 @@ protected function getPackageProviders($app) { $packages = parent::getPackageProviders($app); $packages[] = \RyanChandler\BladeCaptureDirective\BladeCaptureDirectiveServiceProvider::class; - + return $packages; } diff --git a/tests/User.php b/tests/User.php index cc9fb609..7c903500 100644 --- a/tests/User.php +++ b/tests/User.php @@ -5,7 +5,6 @@ // use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; -use Illuminate\Notifications\Notifiable; class User extends Authenticatable implements \Filament\Models\Contracts\FilamentUser { diff --git a/workbench/database/seeders/DatabaseSeeder.php b/workbench/database/seeders/DatabaseSeeder.php index d2afce73..9079f2dc 100644 --- a/workbench/database/seeders/DatabaseSeeder.php +++ b/workbench/database/seeders/DatabaseSeeder.php @@ -2,7 +2,6 @@ namespace Workbench\Database\Seeders; -use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder