Two resources with the same model
Hello, I have two resources and I want to use the same model.
Can you please help.
#❓┊help
5 Replies
protected static ?string $model = User::class;
Create multiple resources and just set the model above.
Then set the navigation slug
If you want same model but different, you can create a new model that extends the other model.
@toeknee_iom thanks 🙏
@toeknee_iom could you please tell me how to filter the records based on the user role, so I want admin to see all posts, but author can see only his post
You should look at Laravel Global Scopes for that, so by default if the user is not admin, apply a where filter to this model.
No, as stated look at the LAravel (not filament) global scopes for models.