I have read as many posts as possible, but none of them can solve my problem.
The route:
Route::model('user', 'User');
Route::group(array('prefix' => 'admin'), function() {
Route::get('users/force-delete/{user}', array(
'as' => 'admin-users-force-delete',
'uses' => 'AdminController@handleUserForceDelete'
));
});
The html:
<li><a href="{{ action('AdminController@handleUserForceDelete', $user->id) }}">Force Delete</a></li>
The handler:
public function handleUserForceDelete(User $user)
{
$username_tmp = $user->username;
$message = 'Success! User ' . $username_tmp . ' has been deleted.';
if($user->trashed())
{
$user->forceDelete();
return Redirect::action('AdminController@showUsers')->with('message', $message);
} else {
return Redirect::action('AdminController@showUsers')->with('message', 'User deletion error! Please try again!');
}
}
I tried to put delete and force-delete at the same handler, and the delete action took place but force-delete generated NotFoundHttpException. So I guess the problem is from the force-delete action??