Are you sure Route::delete is correct? This is for the HTTP verb "DELETE" (and "faked" version of it), and if you are testing with simply going to it via the browser it won't work. If so, change Route::delete to Route::get.
Laravel fakes all PATCH, PUT, DELETE by adding a _method parameter to a POST request.
But, browsers can only make GET request via address bar.
So, you have to either use a RESTfulizer.js implementation or make forms that submit to that route.
Finally your route route would be :
Route::delete('student/{id}', function ($id)
{
User::destroy(1);
return Redirect::back();
})
this code in page new.blade.php (form)
<table border='1'> <thead> <tr> <td>ID</td> <td>Name</td> <td>Number</td> <td>Location</td> <td>Phone</td> <td>Delete</td> </tr> </thead> <tbody> @foreach($allUsers as $newStudent) <tr>
<td>{{ $newStudent->id }}</td>
<td>{{ $newStudent->name }}</td>
<td>{{ $newStudent->number }}</td>
<td>{{ $newStudent->location }}</td>
<td>{{ $newStudent->phone }}</td>
<form action="" method="DELETE" onsubmit="return confirm('Are you sure you want to submit?')">
<td> {{ Form::submit('Delete') }}</td>
</tr>
@endforeach
</tbody>
</table>
{{ Form::close() }}
how to delete row using page routes?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.