diff --git a/src/Configuration.php b/src/Configuration.php index 25d74fb..01a0fdb 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -23,6 +23,6 @@ public function getTartarusModels(): array public static function getModel(string $model): string { - return (new static())::get()->getTartarusModels()[$model]; + return (new static)::get()->getTartarusModels()[$model]; } } diff --git a/src/Middleware/InitTenant.php b/src/Middleware/InitTenant.php index 7a07a77..c0e13f3 100644 --- a/src/Middleware/InitTenant.php +++ b/src/Middleware/InitTenant.php @@ -10,7 +10,6 @@ class InitTenant { - // identifying the tenant in the frontend public function handle(Request $request, Closure $next): Response { $subdomain = $this->makeSubdomain($request->getHost()); diff --git a/src/Models/Company.php b/src/Models/Company.php index 863d4ff..8e407b6 100644 --- a/src/Models/Company.php +++ b/src/Models/Company.php @@ -105,14 +105,7 @@ public function purge(): void public function getFilamentAvatarUrl(): string { if ($this->logo !== null) { - /** @phpstan-ignore-next-line */ - $logo = Media::query() - ->withoutCompany() - ->find($this->logo) - ?->path; - if ($logo !== null) { - return Storage::url($logo); - } + return Storage::url($this->logo); } return $this->defaultProfilePhotoUrl(); diff --git a/src/Models/Concerns/ForCompany.php b/src/Models/Concerns/ForCompany.php index e755f90..df59041 100644 --- a/src/Models/Concerns/ForCompany.php +++ b/src/Models/Concerns/ForCompany.php @@ -15,7 +15,7 @@ public function company(): BelongsTo public static function bootForCompany(): void { - static::addGlobalScope(new CompanyScope()); + static::addGlobalScope(new CompanyScope); static::creating(function ($model) { $model->setAttribute('company_id', tenant('id')); diff --git a/src/TartarusPlugin.php b/src/TartarusPlugin.php index 7e386ba..d5d4d61 100644 --- a/src/TartarusPlugin.php +++ b/src/TartarusPlugin.php @@ -23,7 +23,7 @@ public function register(Panel $panel): void public static function make(): static { - return new self(); + return new self; } public static function get(): static diff --git a/stubs/Models/Role.php b/stubs/Models/Role.php index 43308d1..0421746 100644 --- a/stubs/Models/Role.php +++ b/stubs/Models/Role.php @@ -17,7 +17,7 @@ class Role extends \Spatie\Permission\Models\Role public static function bootForCompany(): void { - static::addGlobalScope(new CompanyAndLandlordScope()); + static::addGlobalScope(new CompanyAndLandlordScope); static::creating(function ($model) { $model->setAttribute('company_id', tenant('id')); diff --git a/stubs/routes/local.php b/stubs/routes/local.php index 7e9cfb3..3cec57c 100644 --- a/stubs/routes/local.php +++ b/stubs/routes/local.php @@ -21,7 +21,7 @@ function load($path): array { $classes = []; - foreach ((new \Symfony\Component\Finder\Finder())->in($path)->files() as $className) { + foreach ((new \Symfony\Component\Finder\Finder)->in($path)->files() as $className) { $classes[] = 'App\\' . str_replace( ['/', '.php'],