'Why does the route name products not work?
I use Laravel with Vue.
I added the following route:
Route::patch('/products/updateOrder', 'Product\ProductController@updateOrder')->name('updateOrder');
I added it in the block:
Route::group([ 'namespace' => 'App\Http\Controllers\Api\BasicData', 'prefix' => 'basicData', 'middleware' => ['role:basicDataAdmin']], function () {
Route::patch('/products/updateOrder', 'Product\ProductController@updateOrder')->name('updateOrder');
Route::get('/products/{product}/productProcesses', 'Product\ProductProcessController@index');
Route::get('/products/{product}/productProcesses/{process}', 'Product\ProductProcessController@show');
Route::post('/products/{product}/productProcesses/{process}', 'Product\ProductProcessController@store');
Route::put('/products/{product}/productProcesses/{process}', 'Product\ProductProcessController@update');
Route::delete('/products/{product}/productProcesses/{process}', 'Product\ProductProcessController@destroy');
Route::resource('/products', 'Product\ProductController')->except(['updateOrder']);
Route::resource('/workplaces', 'Workplace\WorkplaceController');
Route::resource('/partNames', 'PartName\PartNameController');
Route::resource('/processes', 'Process\ProcessController');
});
I get the following error:
"message": "No query results for model [App\\Models\\BasicData\\Product\\Product] updateOrder",
Update order function:
public function updateOrder(Request $request)
{
Product::setNewOrder($request->productIds);
}
I tried to change the order of the routes. Same problem.
When i add an x to the name like this Route::patch('/productsx/updateOrder' it works.
I thought that it's the order of the routes. But it isn't.
Is the only way to solve it to change the name products?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

