Skip to content

Commit

Permalink
fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenjude committed Sep 12, 2024
2 parents ba9b3b3 + e0bb87b commit 2b6cd30
Show file tree
Hide file tree
Showing 16 changed files with 501 additions and 161 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,12 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.1, 8.2]
laravel: [9.*, 10.*, 11.*]
php: [8.2, 8.3]
laravel: [11.*]
stability: [prefer-stable]
include:
- laravel: 9.*
testbench: ^7.0
- laravel: 10.*
testbench: ^8.0
- laravel: 11.*
testbench: ^9.0
exclude:
- laravel: 11.*
php: 8.1

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand Down
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
"require": {
"php": "^8.1",
"filament/filament": "^3.0",
"laravel/horizon": "^5.21",
"laravel/telescope": "^4.16|^5.0",
"spatie/laravel-package-tools": "^1.9.2"
"illuminate/contracts": "^11.0",
"spatie/laravel-package-tools": "^1.16.0"
},
"require-dev": {
"laravel/pint": "^1.13",
"nunomaduro/collision": "^5.11|^6.4|^7.0|^8.0",
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0",
"pestphp/pest": "^1.4|^2.24",
"pestphp/pest-plugin-laravel": "^1.22|^2.2",
"phpunit/phpunit": "^9.0|^10.0"
"laravel/pint": "^1.17",
"nunomaduro/collision": "^8.0",
"orchestra/testbench": "^9.0",
"pestphp/pest": "^3.0",
"pestphp/pest-plugin-laravel": "^3.0",
"pestphp/pest-plugin-livewire": "^3.0",
"phpunit/phpunit": "^11.0"
},
"autoload": {
"psr-4": {
Expand Down
22 changes: 0 additions & 22 deletions config/filament-debugger.php

This file was deleted.

12 changes: 12 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
{
"preset": "laravel",
"rules": {
"blank_line_before_statement": true,
"concat_space": {
"spacing": "one"
},
"method_argument_space": true,
"single_trait_insert_per_statement": true,
"types_spaces": {
"space": "single"
}
},
"exclude": [
"build"
]
Expand Down
44 changes: 0 additions & 44 deletions src/Commands/DebuggerCommand.php

This file was deleted.

52 changes: 30 additions & 22 deletions src/DebuggerPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,19 @@

use Filament\Contracts\Plugin;
use Filament\Panel;
use Stephenjude\FilamentDebugger\Traits\HasDebuggers;
use Stephenjude\FilamentDebugger\Traits\HasAuthorization;
use Stephenjude\FilamentDebugger\Traits\HasGroup;
use Stephenjude\FilamentDebugger\Traits\HasHorizon;
use Stephenjude\FilamentDebugger\Traits\HasPulse;
use Stephenjude\FilamentDebugger\Traits\HasTelescope;

class DebuggerPlugin implements Plugin
{
use HasDebuggers;

public function getId(): string
{
return 'filament-debugger';
}

public function register(Panel $panel): void {}

public function boot(Panel $panel): void
{
$panel->navigationItems(
collect([
'horizon' => $this->horizon(),
'telescope' => $this->telescope(),
])
->only(config('filament-debugger.debuggers'))
->values()
->toArray()
);
}
use HasAuthorization;
use HasGroup;
use HasHorizon;
use HasPulse;
use HasTelescope;

public static function make(): static
{
Expand All @@ -42,4 +30,24 @@ public static function get(): static

return $plugin;
}

public function getId(): string
{
return 'filament-debugger';
}

public function register(Panel $panel): void
{
if ($this->authorized() === false) {
return;
}

$panel->navigationItems(array_filter([
$this->hasHorizon() ? $this->getHorizonNavigation() : null,
$this->hasPulse() ? $this->getPulseNavigation() : null,
$this->hasTelescope() ? $this->getTelescopeNavigation() : null,
]));
}

public function boot(Panel $panel): void {}
}
5 changes: 1 addition & 4 deletions src/DebuggerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@

use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
use Stephenjude\FilamentDebugger\Commands\DebuggerCommand;

class DebuggerServiceProvider extends PackageServiceProvider
{
public function configurePackage(Package $package): void
{
$package
->name('filament-debugger')
->hasConfigFile()
->hasCommand(DebuggerCommand::class);
->name('filament-debugger');
}
}
25 changes: 25 additions & 0 deletions src/Traits/HasAuthorization.php
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;
}
}
37 changes: 0 additions & 37 deletions src/Traits/HasDebuggers.php

This file was deleted.

34 changes: 34 additions & 0 deletions src/Traits/HasGroup.php
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;
}
}
76 changes: 76 additions & 0 deletions src/Traits/HasHorizon.php
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;
}
}
Loading

0 comments on commit 2b6cd30

Please sign in to comment.