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
toeknee
toeknee17mo ago
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.
Mohammed
MohammedOP17mo ago
@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
toeknee
toeknee17mo ago
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.
toeknee
toeknee17mo ago
No, as stated look at the LAravel (not filament) global scopes for models.
Want results from more Discord servers?
Add your server