Skip to content

Commit

Permalink
manual format
Browse files Browse the repository at this point in the history
  • Loading branch information
awcodes committed Jan 16, 2024
1 parent 6eb6b5f commit 7daae99
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/QuickCreatePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ class QuickCreatePlugin implements Plugin

protected bool $sort = true;

protected bool|Closure|null $shouldUseSlideOver = null;
protected bool | Closure | null $shouldUseSlideOver = null;

protected string|Closure $sortBy = 'label';
protected string | Closure $sortBy = 'label';

protected bool|Closure $hidden = false;
protected bool | Closure $hidden = false;

public function boot(Panel $panel): void
{
Livewire::component('quick-create-menu', Components\QuickCreateMenu::class);

$this->getResourcesUsing(fn() => $panel->getResources());
$this->getResourcesUsing(fn () => $panel->getResources());
}

public function excludes(array $resources): static
Expand Down Expand Up @@ -78,12 +78,12 @@ public function getResources(): array

$list = collect($resources)
->filter(function ($item) {
return !in_array($item, $this->getExcludes());
return ! in_array($item, $this->getExcludes());
})
->map(function ($resourceName): ?array {
$resource = app($resourceName);

if (Filament::hasTenancy() && !Filament::getTenant()) {
if (Filament::hasTenancy() && ! Filament::getTenant()) {
return null;
}

Expand All @@ -96,15 +96,15 @@ public function getResources(): array
'model' => $resource->getModel(),
'icon' => $resource->getNavigationIcon(),
'action_name' => $actionName,
'action' => !$resource->hasPage('create') ? 'mountAction(\'' . $actionName . '\')' : null,
'action' => ! $resource->hasPage('create') ? 'mountAction(\'' . $actionName . '\')' : null,
'url' => $resource->hasPage('create') ? $resource::getUrl('create') : null,
'navigation' => $resource->getNavigationSort(),
];
}

return null;
})
->when($this->isSortable(), fn($collection) => $collection->sortBy($this->sortBy))
->when($this->isSortable(), fn ($collection) => $collection->sortBy($this->sortBy))
->values()
->toArray();

Expand Down Expand Up @@ -133,7 +133,7 @@ public function register(Panel $panel): void
$panel
->renderHook(
name: 'panels::user-menu.before',
hook: fn(): string => Blade::render('@livewire(\'quick-create-menu\')')
hook: fn (): string => Blade::render('@livewire(\'quick-create-menu\')')
);
}

Expand All @@ -149,16 +149,16 @@ public function slideOver(bool $condition = true): static
return $this;
}

public function sort(bool|Closure $condition = true): static
public function sort(bool | Closure $condition = true): static
{
$this->sort = $condition;

return $this;
}

public function sortBy(string|Closure $sortBy = 'label'): static
public function sortBy(string | Closure $sortBy = 'label'): static
{
if (!in_array($sortBy, ['label', 'navigation'])) {
if (! in_array($sortBy, ['label', 'navigation'])) {
$sortBy = 'label';
}

Expand All @@ -167,7 +167,7 @@ public function sortBy(string|Closure $sortBy = 'label'): static
return $this;
}

public function hidden(bool|Closure $hidden = true): static
public function hidden(bool | Closure $hidden = true): static
{
$this->hidden = $hidden;

Expand Down

0 comments on commit 7daae99

Please sign in to comment.