saade / filament-laravel-log

Read Laravel logs from the Filament admin panel
https://filamentphp.com/plugins/saade-laravel-log
MIT License
94 stars 21 forks source link

Exception: Target class [hash] does not exist #27

Closed malle-pietje closed 8 months ago

malle-pietje commented 1 year ago

Hi,

Thanks for creating this plugin, I believe it's very useful!

One thing I discovered is when I add this callback for the authorize() method an Exception is thrown:

        ->authorize(
            fn () => auth()->user()->hasRole('super_admin')
        ),

This is the Exception: image

Any clues on why this is happening?

malle-pietje commented 1 year ago

The install is using plain "stable" Filament with a couple of plugins enabled.

malle-pietje commented 1 year ago

For now I've solved the issue by creating a custom page that extends Saade\FilamentLaravelLog\Pages\ViewLog and uses the HasPageShield Trait provided by Shield like so:

<?php

namespace App\Filament\Pages;

use BezhanSalleh\FilamentShield\Traits\HasPageShield;
use Saade\FilamentLaravelLog\Pages\ViewLog;

class CustomLogs extends ViewLog
{
    use HasPageShield;

    public function getTitle(): string
    {
        return __('Application Logs');
    }
}

To hide the default, built-in, page the plugin is configured like so in the PanelProvider:

                FilamentLaravelLogPlugin::make()
                    ->navigationGroup('Logs')
                    ->navigationLabel('Application Logs')
                    ->navigationIcon('heroicon-o-bug-ant')
                    ->navigationSort(1)
                    ->slug('application_logs')
                    ->authorize(
                        fn () => false // hides the built-in page
                    ),
Darker3x commented 1 year ago

exactly same problem for me too

Kwenziwa commented 1 year ago

Im also facing the same issue.

emjay64 commented 1 year ago

Same issue here as well.

saade commented 8 months ago

38