jeudi 29 décembre 2016

Delete a record gave me NotFoundException in laravel 5

How can I create multiple requests for the same route like below.

Route.php

Route::get('/home', 'HomeController@index');//->middleware('auth');
Route::get('/home/{$user}','HomeController@showStudent');
Route::delete('/home/{$studentId}','HomeController@deleteStudent');

the form was working fine until I have added the delete request. In my blade template I have code something like this.

home.blade.php

  <form class="" role="form" method="DELETE" action="/home/">
                            
                            <td><button type="submit" class="btn btn-primary pull-right">Remove Student</button></td>
                            </form>

I believe because of the same routes it's showing NotFoundHTTPException.

On one route /home I am trying to Add, Show, Edit and Delete a record with different buttons.

Thanks in Advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire