Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to integrate/use Filament shield for roles and Permission #18

Closed
MarJose123 opened this issue Aug 24, 2022 · 3 comments
Closed

Allow to integrate/use Filament shield for roles and Permission #18

MarJose123 opened this issue Aug 24, 2022 · 3 comments

Comments

@MarJose123
Copy link

Allow to add use HasPageShield; traits based on this documentation.

https://github.com/bezhanSalleh/filament-shield#pages

@Z3d0X
Copy link
Owner

Z3d0X commented Aug 24, 2022

Hi, filament-shield should already automatically pickup the ActivityResource from this package and generate permissions for it.
However you'd need to manually hook up the policy generated by shield to spaites Activity Model
Is this what you are asking or have i misunderstood the question?

@MarJose123
Copy link
Author

the policy generated by shield to spaites Activity Model is already in there but the Resource is still showing up.

@Z3d0X
Copy link
Owner

Z3d0X commented Aug 24, 2022

However you'd need to manually hook up the policy generated by shield to spaites Activity Model.

Since Activity Model is in a package laravel doesn't automatically pickup the policy for it
Do this in your AuthServiceProvider and it should work

<?php

namespace App\Providers;

use Spatie\Activitylog\Models\Activity;
use App\Policies\ActivityPolicy;

class AuthServiceProvider extends ServiceProvider
{
    protected $policies = [
        Activity::class => ActivityPolicy::class, // <- add this
    ];
    
    public function boot()
    {
        $this->registerPolicies();
    }
}

@Z3d0X Z3d0X closed this as completed Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants