Edit Resource model

Hello again everyone. can i edit the model of a given resource as shown in the attached file on line 18?
15 Replies
toeknee
toeknee15mo ago
Of course.. What are you trying to do?
Lambertn33
Lambertn3315mo ago
@toeknee_iom I want to point this Resource to \App\Models\MainWarehouse::class
toeknee
toeknee15mo ago
It's already going there....
Lambertn33
Lambertn3315mo ago
I want to make several resources which are pointing to one Model but based on record status! it is failing when I am trying to open the creation modal
toeknee
toeknee15mo ago
The use at the top shows it's using that model. What is failing, can you provide more context
Lambertn33
Lambertn3315mo ago
this is the error I am getting
toeknee
toeknee15mo ago
That is going to a different Model
Dennis Koch
Dennis Koch15mo ago
That's not a Resource! It's a page.
Lambertn33
Lambertn3315mo ago
can't I have one model( MainWarehouse::class ) to be used by 2 or more resources?
Dennis Koch
Dennis Koch15mo ago
Sure you can.
toeknee
toeknee15mo ago
You can sure I have one model in 50 resources for one project lols But you need to define the Model Class in the resource, you are defining it in the list / page The sub pages reference the resource always to reduce duplication of code
Lambertn33
Lambertn3315mo ago
Ooooh sure @toeknee_iom Thanks for this. it is working now! I was defining the $model in page not in resource but when i try to open the modal for creating I still got some issues
Lambertn33
Lambertn3315mo ago
toeknee
toeknee15mo ago
You haven't included the
use App\Models\MainWareHouse;
use App\Models\MainWareHouse;
Lambertn33
Lambertn3315mo ago
God bless you @toeknee_iom @Dennis Koch it is working perfectly now