I\'m testing a method using Sweet Alert, to improve the messages issued by the Javascript alert method with the laravel framework.
1 - I downloaded the files sweetal
in the view :
in the Jquery and Ajax :
in the Controller:
public function destroy(User $user, Request $request, $id)
{
if ($request->ajax()){
$user = User::findOrFail($id);
if ($user){
$user->delete();
return response()->json(array('success' => true));
}
}
}
in the Route
Route::delete('/user/delete/{id}','UserController@destroy');