Get extra parameters from URL for resources
Hello everyone
I have a nested resource.
In this way, I have a product resource that shows the list of products and I have made a list of attributes that shows the list of attribute according to the product ID, and you can also create or edit a new attribute for it.
And its url is as follows.
create url : /manager/product/attributes/{product}/create
edit url : /manager/product/attributes/{product}/{attribute}/edit
According to the product parameter in the url, I edited the getEloquent method and wrote it as follows.
public static function getTableQuery(): Builder
{
return parent::getEloquentQuery()
->where('attributeable_type', product()->model())
->where('attributeable_id', request('product'));
}
Now, when I add a delete action to the table, I get an error.
Because when removing the attribute, there is no product id parameter in the request.
This is because the deletion was done by the url related to livewire/update.
Keep this in mind, currently the creation and editing operation is working correctly as a page.
But there is an error in modal like the Delete operation.
Can someone tell me how I can keep this product parameter that is in the URL and use it in all situations?
0 Replies