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
toeknee2y ago
Of course.. What are you trying to do?
Lambertn33
Lambertn33OP2y ago
@toeknee_iom I want to point this Resource to \App\Models\MainWarehouse::class
toeknee
toeknee2y ago
It's already going there....
Lambertn33
Lambertn33OP2y 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
toeknee2y ago
The use at the top shows it's using that model. What is failing, can you provide more context
Lambertn33
Lambertn33OP2y ago
this is the error I am getting
toeknee
toeknee2y ago
That is going to a different Model
Dennis Koch
Dennis Koch2y ago
That's not a Resource! It's a page.
Lambertn33
Lambertn33OP2y ago
can't I have one model( MainWarehouse::class ) to be used by 2 or more resources?
Dennis Koch
Dennis Koch2y ago
Sure you can.
toeknee
toeknee2y 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
Lambertn33OP2y 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
Lambertn33OP2y ago
toeknee
toeknee2y ago
You haven't included the
use App\Models\MainWareHouse;
use App\Models\MainWareHouse;
Lambertn33
Lambertn33OP2y ago
God bless you @toeknee_iom @Dennis Koch it is working perfectly now
Want results from more Discord servers?
Add your server