How to show same table data in different pages?
I have a user table and there have a column role where have different roles like 'admin', 'agent', and 'customer'. Now I want to show users in different pages role based, how to do that? Also, when I want to create user, I want to add some extra data on other table if user type is agent or customer.
6 Replies
1. You can override
getEloquentQuery()
like this https://filamentphp.com/docs/3.x/panels/resources/getting-started#disabling-global-scopes
2. You can use lifecycle hooks https://filamentphp.com/docs/3.x/panels/resources/creating-records#lifecycle-hooks or you can use observer https://laravel.com/docs/10.x/eloquent#observerscan you please give me a real example of that how i can do that?
what kind of real example rather than those links? maybe I am not clear about the exact requirement you had. if you can post how you tried then it will be easy to help
I have two tables, users and user_details. now I have a form where I get name, email, password, and type. Now I want to save name, and type in user_details and other data in users. Give me a real example, please. Also, I want to show all data in a table. Thank you.
It's easy, you define relationship then you call like
make(user.name)
for more details ref docs, i'm on phone rnthere are two ways, 1. create relation and 2. lifecycle hooks. I understand this but how to get the form data in lifecycle hook or relation?