samedi 13 octobre 2018

Unknown Laravel Exception

I'm setting up routes between my Vue.js app and Laravel. I've setup CSRF with Vue.js, but Laravel now throws the error below when I try and use my PageController@store method.

"message": "No query results for model [App\\Page].",
"exception": 
"Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException",

This is unexpected, as my store method only returns the request as JSON (I have also tried this with the store method empty).

/**
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(Request $request)
{
    return response()->json($request);
}

Here is my route:

Route::resource('/admin/resource/pages', 'PageController');

And lastly, here's my Vue.js method that sends the data to Laravel.

post (model){
    this.$http.post("/admin/resource/pages/store", {
        _method: "put",
        model: model
    }, {}).then(response => {
        console.log(response);
    });
}

Any help is appreciated, thank-you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire