I am working with Laravel 5.6 and going delete users fron users table as admin. I have following UserController function to delete table records?
public function delete($id)
{
User::where('id', $id)
->delete();
return redirect()->back()->with('info', 'User deleted successfully');
}
and My users data showing in index blade file with concluding delete buttons like this,
<td><a class="button is-outlined" href="" onclick="return confirm('Are you sure to want to delete this record?')" >Delete</a></td>
and My delete route is like this,
Route::get('users/{users}/delete', [
'uses' => '\App\Http\Controllers\UserController@delete',
]);
but now when I click delete button javascript conformation coming and after accept it not deleting records. url is change like this
http://localhost:8000/users?16/delete/ //16 is user id
how can I fix this problem?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2KKQBt0
via IFTTT
Aucun commentaire:
Enregistrer un commentaire