2 Different Tables For The Same Resource
How can I have two different tables for the same resource with a different route for each. I want to have different fields for each and they both go to the same add/edit form?
5 Replies
You can create another Resource with the same Model.
Just change the $model, for example User.
I don’t understand 2 different tables on 2 different routes can still use the same resource as long as you have 2 separate routes. It’s just that one of those those routes will have to be a custom page. Ie, you can’t have 2 different index routes and expect them to just have the same functionality.
But it’s still just OOP. So just extend the default index rout and give it a different route in the resources’ get route method.
What would the actual url path be that is different between the two. Maybe start there.
The OP asked how to make 2 different CRUD with the same "Resource", which can be confused.
Because, one CRUD = one Resource.
So, my guess the OP want to have 2 different CRUD, with the same Model.
I didn’t pick that up all. I read it as 2 different index routes for the same model.
jawaad is on the right path. Let's say it's the User model.
I want to have one table that shows the list of records with certain fields from the User model and another table that shows other fields from the User model but I would like the Add/Edit Form to be the same for both so if I make changes to the form, I don't have to make it in 2 places which I would have to do if I create 2 separate resources for the one model.