Support the ongoing development of Laravel.io →
Configuration Database Eloquent
Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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();
})
Last updated 2 years ago.
0

not work code

Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

whatis the problem?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.