Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Company.php #34

Merged
merged 3 commits into from
Aug 21, 2024
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
2 changes: 1 addition & 1 deletion src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
1 change: 0 additions & 1 deletion src/Middleware/InitTenant.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
9 changes: 1 addition & 8 deletions src/Models/Company.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Concerns/ForCompany.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
2 changes: 1 addition & 1 deletion src/TartarusPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion stubs/Models/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
2 changes: 1 addition & 1 deletion stubs/routes/local.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down