generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e35d6c
commit 97f97ee
Showing
23 changed files
with
606 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BezhanSalleh\FilamentExceptions\Concerns; | ||
|
||
trait HasLabels | ||
{ | ||
protected bool $isGloballySearchable = true; | ||
|
||
protected ?string $modelLabel = null; | ||
|
||
protected ?string $pluralModelLabel = null; | ||
|
||
protected bool $hasTitleCaseModelLabel = true; | ||
|
||
public function modelLabel(string $label): static | ||
{ | ||
$this->modelLabel = $label; | ||
|
||
return $this; | ||
} | ||
|
||
public function pluralModelLabel(string $label): static | ||
{ | ||
$this->pluralModelLabel = $label; | ||
|
||
return $this; | ||
} | ||
|
||
public function titleCaseModelLabel(bool $condition = true): static | ||
{ | ||
$this->hasTitleCaseModelLabel = $condition; | ||
|
||
return $this; | ||
} | ||
|
||
public function getModelLabel(): string | ||
{ | ||
return $this->modelLabel ?? __('filament-exceptions::filament-exceptions.labels.model'); | ||
} | ||
|
||
public function getPluralModelLabel(): string | ||
{ | ||
return $this->pluralModelLabel ?? __('filament-exceptions::filament-exceptions.labels.model_plural'); | ||
} | ||
|
||
public function hasTitleCaseModelLabel(): bool | ||
{ | ||
return $this->hasTitleCaseModelLabel; | ||
} | ||
|
||
public function globallySearchable(bool $condition = true): static | ||
{ | ||
$this->isGloballySearchable = $condition; | ||
|
||
return $this; | ||
} | ||
|
||
public function canGloballySearch(): bool | ||
{ | ||
return $this->isGloballySearchable; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BezhanSalleh\FilamentExceptions\Concerns; | ||
|
||
use Carbon\Carbon; | ||
|
||
trait HasModelPruneInterval | ||
{ | ||
protected ?Carbon $modelPruneInterval = null; | ||
|
||
public function modelPruneInterval(Carbon $interval): static | ||
{ | ||
$this->modelPruneInterval = $interval; | ||
|
||
return $this; | ||
} | ||
|
||
public function getModelPruneInterval(): Carbon | ||
{ | ||
return $this->modelPruneInterval ?? now()->subWeek(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BezhanSalleh\FilamentExceptions\Concerns; | ||
|
||
use Filament\Pages\SubNavigationPosition; | ||
|
||
trait HasNavigation | ||
{ | ||
protected bool $shouldEnableNavigationBadge = false; | ||
|
||
protected string | array | null $navigationBadgeColor = null; | ||
|
||
protected ?string $navigationGroup = null; | ||
|
||
protected ?string $navigationParentItem = null; | ||
|
||
protected ?string $navigationIcon = null; | ||
|
||
protected ?string $activeNavigationIcon = null; | ||
|
||
protected ?string $navigationLabel = null; | ||
|
||
protected ?int $navigationSort = null; | ||
|
||
protected ?string $slug = null; | ||
|
||
protected bool $shouldRegisterNavigation = true; | ||
|
||
protected SubNavigationPosition $subNavigationPosition = SubNavigationPosition::Start; | ||
|
||
public function getSubNavigationPosition(): SubNavigationPosition | ||
{ | ||
return $this->subNavigationPosition; | ||
} | ||
|
||
public function navigationBadge(bool $condition = true): static | ||
{ | ||
$this->shouldEnableNavigationBadge = $condition; | ||
|
||
return $this; | ||
} | ||
|
||
public function shouldEnableNavigationBadge(): bool | ||
{ | ||
return $this->shouldEnableNavigationBadge; | ||
} | ||
|
||
public function navigationBadgeColor(string | array $color): static | ||
{ | ||
$this->navigationBadgeColor = $color; | ||
|
||
return $this; | ||
} | ||
|
||
public function getNavigationBadgeColor(): string | array | null | ||
{ | ||
return $this->navigationBadgeColor; | ||
} | ||
|
||
public function navigationGroup(?string $group): static | ||
{ | ||
$this->navigationGroup = $group; | ||
|
||
return $this; | ||
} | ||
|
||
public function getNavigationGroup(): ?string | ||
{ | ||
return $this->navigationGroup ?? __('filament-exceptions::filament-exceptions.labels.navigation_group'); | ||
} | ||
|
||
public function getNavigationParentItem(): ?string | ||
{ | ||
return $this->navigationParentItem; | ||
} | ||
|
||
public function navigationParentItem(?string $item): static | ||
{ | ||
$this->navigationParentItem = $item; | ||
|
||
return $this; | ||
} | ||
|
||
public function getNavigationIcon(): ?string | ||
{ | ||
return $this->navigationIcon ?? 'heroicon-o-bug-ant'; | ||
} | ||
|
||
public function navigationIcon(?string $icon): static | ||
{ | ||
$this->navigationIcon = $icon; | ||
|
||
return $this; | ||
} | ||
|
||
public function activeNavigationIcon(?string $icon): static | ||
{ | ||
$this->activeNavigationIcon = $icon; | ||
|
||
return $this; | ||
} | ||
|
||
public function getActiveNavigationIcon(): ?string | ||
{ | ||
return $this->activeNavigationIcon ?? 'heroicon-o-bug-ant'; | ||
} | ||
|
||
public function navigationLabel(?string $label): static | ||
{ | ||
$this->navigationLabel = $label; | ||
|
||
return $this; | ||
} | ||
|
||
public function getNavigationLabel(): ?string | ||
{ | ||
return $this->navigationLabel ?? __('filament-exceptions::filament-exceptions.labels.navigation'); | ||
} | ||
|
||
public function navigationSort(?int $sort): static | ||
{ | ||
$this->navigationSort = $sort; | ||
|
||
return $this; | ||
} | ||
|
||
public function getNavigationSort(): ?int | ||
{ | ||
return $this->navigationSort; | ||
} | ||
|
||
public function shouldRegisterNavigation(): bool | ||
{ | ||
return $this->shouldRegisterNavigation; | ||
} | ||
|
||
public function slug(string $slug): static | ||
{ | ||
$this->slug = $slug; | ||
|
||
return $this; | ||
} | ||
|
||
public function getSlug(): ?string | ||
{ | ||
return $this->slug; | ||
} | ||
} |
Oops, something went wrong.