Giter Site home page Giter Site logo

filament-logviewer's People

Contributors

curder avatar onexer avatar rabol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

filament-logviewer's Issues

Issue with custom policy not being used in Laravel Log Viewer

I downloaded the log viewer library in Laravel and followed the installation instructions. However, I'm encountering an error when trying to use my custom policy. The error message states: "Rabol\FilamentLogviewer\Policies\LogFilePolicy::delete(): Argument #1 ($user) must be of type App\Models\User, App\Models\Admin given, called in C:\github\backend-rakeb\vendor\laravel\framework\src\Illuminate\Auth\Access\Gate.php on ...".

Steps to Reproduce:

  1. Install the log viewer library following the provided instructions.
  2. Open the configuration file located at config/filament-logviewer.php.
  3. In the configuration file, ensure that the policy_class key is set to the correct namespace and class name of your custom policy, which is App\Policies\LogFilePolicy::class.
  4. Save the configuration file.

Expected Behavior:
I expected the log viewer library to use my custom policy, App\Policies\LogFilePolicy, for authorization checks.

Actual Behavior:
Instead of using my custom policy, the log viewer library is trying to use Rabol\FilamentLogviewer\Policies\LogFilePolicy and encountering a type error when calling the delete method.

Custom Policy Contents:

<?php

namespace App\Policies;

use App\Models\Admin;
use Illuminate\Auth\Access\HandlesAuthorization;

class LogFilePolicy
{
    use HandlesAuthorization;

    public function view(Admin $Admin)
    {
        return true;
    }

    public function viewAny(Admin $Admin)
    {
        return true;
    }

    public function create(Admin $Admin)
    {
        return true;
    }

    public function update(Admin $Admin)
    {
        return true;
    }

    public function delete(Admin $Admin)
    {
        return true;
    }

    public function deleteAny(Admin $Admin)
    {
        return true;
    }
}


Contents of config/filament-logviewer.php:
<?php
// config for Rabol/FilamentLogviewer

use App\Policies\LogFilePolicy;

return [
    'navigation_group' => 'System',
    'model_class' => \Rabol\FilamentLogviewer\Models\LogFile::class,
    'policy_class' => LogFilePolicy::class,
];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.