Laravel-Backpack/MenuCRUD

Unable to override the MenuItem model

t-prod opened this issue · 1 comments

Hi,

I would like to override Backpack\MenuCRUD\app\Models\MenuItem by creating a app/Models/MenuItem.php which extends Model.

I just want to redefine the url function.

But nothing happens :( What did I do wrong ?

Thanks for your help and congratulations about your brillant package.

Regards

Hi @t-prod ,

You should be able to overwrite the route if you define the same one in your routes file:

Route::group(['prefix' => config('backpack.base.route_prefix'), 'middleware' => ['admin'], 'namespace' => 'Admin'], function () {
                CRUD::resource('menu-item', 'MenuItemCrudController');
            });

This would send that route to your own MenuItemCrudController, where you'd use your MenuItem model.

Hope it helps.
Cheers!