generated from spatie/package-skeleton-laravel
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Showing
16 changed files
with
501 additions
and
161 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 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
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,25 @@ | ||
<?php | ||
|
||
namespace Stephenjude\FilamentDebugger\Traits; | ||
|
||
use Closure; | ||
use Filament\Support\Concerns\EvaluatesClosures; | ||
|
||
trait HasAuthorization | ||
{ | ||
use EvaluatesClosures; | ||
|
||
public Closure | bool $authorized = true; | ||
|
||
public function authorize(Closure | bool $condition = true): static | ||
{ | ||
$this->authorized = $condition; | ||
|
||
return $this; | ||
} | ||
|
||
public function authorized(): bool | ||
{ | ||
return $this->evaluate($this->authorized) === true; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Stephenjude\FilamentDebugger\Traits; | ||
|
||
use Closure; | ||
use Filament\Support\Concerns\EvaluatesClosures; | ||
|
||
trait HasGroup | ||
{ | ||
use EvaluatesClosures; | ||
|
||
public Closure | bool $groupNavigation = true; | ||
|
||
public string $groupNavigationLabel = 'Debuggers'; | ||
|
||
public function groupNavigation(Closure | bool $condition = true, string $label = 'Debugger'): static | ||
{ | ||
$this->groupNavigation = $condition; | ||
|
||
$this->groupNavigationLabel = $label; | ||
|
||
return $this; | ||
} | ||
|
||
public function hasGroupNavigation(): bool | ||
{ | ||
return $this->evaluate($this->groupNavigation) === true; | ||
} | ||
|
||
public function getGroupNavigationLabel(): string | ||
{ | ||
return $this->groupNavigationLabel; | ||
} | ||
} |
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,76 @@ | ||
<?php | ||
|
||
namespace Stephenjude\FilamentDebugger\Traits; | ||
|
||
use Closure; | ||
use Filament\Navigation\NavigationItem; | ||
use Filament\Support\Concerns\EvaluatesClosures; | ||
|
||
trait HasHorizon | ||
{ | ||
use EvaluatesClosures; | ||
|
||
public Closure | bool $hasHorizon = true; | ||
|
||
public string $horizonLabel; | ||
|
||
public string $horizonIcon; | ||
|
||
public string $horizonUrl; | ||
|
||
public Closure | bool $horizonOpenInNewTab = true; | ||
|
||
private function getHorizonNavigation(): NavigationItem | ||
{ | ||
return NavigationItem::make() | ||
->group($this->hasGroupNavigation() ? $this->getGroupNavigationLabel() : null) | ||
->url(url: $this->getHorizonUrl(), shouldOpenInNewTab: $this->getHorizonOpenInNewTab()) | ||
->icon(icon: $this->getHorizonIcon()) | ||
->label(label: $this->getHorizonLabel()); | ||
} | ||
|
||
public function horizonNavigation( | ||
Closure | bool $condition = true, | ||
string $label = 'Horizon', | ||
string $icon = 'heroicon-o-globe-europe-africa', | ||
string $url = 'horizon', | ||
Closure | bool $openInNewTab = true | ||
): static { | ||
$this->hasHorizon = $condition; | ||
|
||
$this->horizonLabel = $label; | ||
|
||
$this->horizonIcon = $icon; | ||
|
||
$this->horizonUrl = $url; | ||
|
||
$this->horizonOpenInNewTab = $openInNewTab; | ||
|
||
return $this; | ||
} | ||
|
||
public function hasHorizon(): bool | ||
{ | ||
return $this->evaluate($this->hasHorizon ?? false) === true; | ||
} | ||
|
||
public function getHorizonIcon(): string | ||
{ | ||
return $this->horizonIcon ?? 'heroicon-o-globe-europe-africa'; | ||
} | ||
|
||
public function getHorizonUrl(): string | ||
{ | ||
return $this->horizonUrl ?? url('horizon'); | ||
} | ||
|
||
public function getHorizonLabel(): string | ||
{ | ||
return $this->horizonLabel ?? 'Horizon'; | ||
} | ||
|
||
public function getHorizonOpenInNewTab(): bool | ||
{ | ||
return $this->evaluate($this->horizonOpenInNewTab ?? true) === true; | ||
} | ||
} |
Oops, something went wrong.