Skip to content

Commit

Permalink
Merge pull request #25 from arnor01/feature/laravel-11
Browse files Browse the repository at this point in the history
Support for laravel 11
  • Loading branch information
stephenjude committed Mar 14, 2024
2 parents d6b7714 + 5a28e7c commit 4bf45b1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/run-tests.yml
Expand Up @@ -14,15 +14,18 @@ jobs:
matrix:
os: [ubuntu-latest]
php: [8.1, 8.2]
laravel: [8.*, 9.*, 10.*]
laravel: [9.*, 10.*, 11.*]
stability: [prefer-stable]
include:
- laravel: 8.*
testbench: ^6.0
- 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
13 changes: 6 additions & 7 deletions composer.json
Expand Up @@ -18,18 +18,17 @@
"require": {
"php": "^8.1",
"filament/filament": "^3.0",
"illuminate/contracts": "^10.0",
"laravel/horizon": "^5.21",
"laravel/telescope": "^4.16",
"laravel/telescope": "^4.16|^5.0",
"spatie/laravel-package-tools": "^1.9.2"
},
"require-dev": {
"laravel/pint": "^1.13",
"nunomaduro/collision": "^7.0",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^2.24",
"pestphp/pest-plugin-laravel": "^2.2",
"phpunit/phpunit": "^10.0"
"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"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 5 additions & 5 deletions src/Traits/HasDebuggers.php
Expand Up @@ -6,7 +6,7 @@

trait HasDebuggers
{
private function authorized(string $ability): bool
private static function authorized(string $ability): bool
{
if (config('filament-debugger.authorization')) {
return (bool) auth(config('filament.auth.guard'))->user()?->can($ability);
Expand All @@ -15,20 +15,20 @@ private function authorized(string $ability): bool
return true;
}

public function telescope(): NavigationItem
public static function telescope(): NavigationItem
{
return NavigationItem::make()
->visible($this->authorized(config('filament-debugger.permissions.telescope')))
->visible(self::authorized(config('filament-debugger.permissions.telescope')))
->group(config('filament-debugger.group'))
->url(url: url()->to(config('filament-debugger.url.telescope')), shouldOpenInNewTab: true)
->icon('heroicon-o-sparkles')
->label('Telescope');
}

public function horizon(): NavigationItem
public static function horizon(): NavigationItem
{
return NavigationItem::make()
->visible($this->authorized(config('filament-debugger.permissions.horizon')))
->visible(self::authorized(config('filament-debugger.permissions.horizon')))
->group(config('filament-debugger.group'))
->icon('heroicon-o-globe-europe-africa')
->url(url: url()->to(config('filament-debugger.url.horizon')), shouldOpenInNewTab: true)
Expand Down
5 changes: 3 additions & 2 deletions tests/DebuggerTest.php
@@ -1,5 +1,6 @@
<?php

use Filament\Navigation\NavigationItem;
use Stephenjude\FilamentDebugger\DebuggerPlugin;

it('can install configurations', function () {
Expand All @@ -11,9 +12,9 @@
});

it('can open horizon', function () {
$this->get(DebuggerPlugin::horizon())->assertSuccessful();
expect(DebuggerPlugin::horizon())->toBeInstanceOf(NavigationItem::class);
});

it('can open telescope', function () {
$this->get(DebuggerPlugin::telescope())->assertSuccessful();
expect(DebuggerPlugin::telescope())->toBeInstanceOf(NavigationItem::class);
});

0 comments on commit 4bf45b1

Please sign in to comment.