can you show me your routes file.
"No query results for model on trying to remove menu
When I try to remove a menu in our application I get
{
"message": "No query results for model [App\Models\Editor\Project].",
"exception": "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",
"file": "/Users/user/code/domain.com/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",
"line": 380,
"trace": [
{
"file": "/Users/user/code/domain.com/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php",
"line": 356,
"function": "prepareException",
"class": "Illuminate\Foundation\Exceptions\Handler",
"type": "->"
},
{
"file": "/Users/user/code/domain.com/app/Exceptions/Handler.php",
"line": 57,
"function": "render",
"class": "Illuminate\Foundation\Exceptions\Handler",
"type": "->"
},
So for some reason this model cannot load its data and I get a 404 running https://site.test/editor/delete-menu/55
That route loads this controller method:
...
public function deleteMenu(Menu $menu)
{
try {
$menu->delete();
return $this->respondWithSuccess(200, $menu->id);
} catch (\Exception $e) {
return $this->respondFailedWithError(500, $e->getMessage());
}
}
...
and also
remove(menu, event) {
event.stopPropagation();
axios.delete('/editor/delete-menu/' + menu.id)
.then(this.handleRemove)
.catch(this.catch);
},
for JS way with resources/js/components/editor/sidebar/MenuList.vue. So this last Vue method was actually called failing on me..
Other odd thing is that menu 55 is still in the table menus... So a 404 makes no sense really.
Hmm, due to application project storage and load changes removal path with Axios seems to need
...
axios.delete('/editor/delete-menu/' + menu.id + `?project=${PROJECT_ID}`)
...
now. This so it can load const PROJECT_ID = {{ $project->id }} from blade template view.
Please or to participate in this conversation.