Skip to content

Commit

Permalink
Merge pull request #34 from lara-zeus/fix-media
Browse files Browse the repository at this point in the history
Update Company.php
  • Loading branch information
atmonshi authored Aug 21, 2024
2 parents 5fbf3dc + 314ba26 commit 42fe475
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 14 deletions.
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

0 comments on commit 42fe475

Please sign in to comment.