简体   繁体   English

编辑行上出现错误404-背包Crud- Laravel

[英]Error 404 on edit rows - Backpack crud- Laravel

I'm actually inserting data without problems on my DB...but when I try to edit one row and save the changes... it throws me this error... 我实际上是在数据库上插入数据而没有问题...但是当我尝试编辑一行并保存更改时...会抛出此错误...

"No query results for model [model's name]" “没有关于模型[模型名称]的查询结果”

I already try to fix that with => protected $primaryKey = 'id'; 我已经尝试用=> protected $ primaryKey ='id';来解决这个问题。 On my model. 在我的模型上。

But still getting the same error ....any help ? 但是仍然出现相同的错误..任何帮助吗?

The specific error route looks like "admin/titulares/2" 具体的错误路由类似于“ admin / titulares / 2”

and before I press the save button like "admin/titulares/2/edit" 在我按下“ admin / titulares / 2 / edit”之类的保存按钮之前

编辑行

My routes 我的路线

Route::group([
'middleware' => ['prefix'     => config('backpack.base.route_prefix', 'admin'),
                'web', config('backpack.base.middleware_key', 'admin')],
                'namespace'  => 'App\Http\Controllers\Admin',
                ], function () { // custom admin routes
                Route::get('dashboard', 'dashboardController@dashboard');

                #CRUD::resource('equipos', 'EquiposCrudController');
                #CRUD::resource('regiones', 'RegionesCrudController');
                CRUD::resource('parametros', 'ParametrosCrudController');
                CRUD::resource('estaciones', 'EstacionesCrudController');
                #CRUD::resource('redes', 'RedesCrudController');
                #CRUD::resource('huso', 'HusoCrudController');
                CRUD::resource('titulares', 'TitularesCrudController');
                CRUD::resource('operadores', 'OperadoresCrudController');
               });

UPDATE: 更新:

This is my edit form action (it uses https://laravelcollective.com/docs/5.0/html ) 这是我的编辑表单操作(它使用https://laravelcollective.com/docs/5.0/html

{!! Form::open(array('url' => $crud->route.'/'.$entry->getKey(), 'method' => 'put', 'files'=>$crud->hasUploadFields('update', $entry->getKey()))) !!}

Are you sure using right method for update, You should use put for update data, for example, 您确定使用正确的方法进行更新吗?您应该使用put来更新数据,例如,

Route::put('example/{id}', 'ExampleController@update')

I hope this will help 我希望这个能帮上忙

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM