我需要在用户删除帐户时重定向注销我的应用。使用此UserController
public function destroy($id) {
$users = User::findOrFail($id);
$users->delete();
Auth::logout();
return Auth::logout();
//redirect()->back()->with('info','Your Account has beed deleted successfully');
}
我的删除按钮是index.blade.php
中的<button class="btn btn-circle btn-danger delete"
data-action="{{ url('users/' . $use->id) }}"
data-token="{{csrf_token()}}">
<i class="fa fa-trash-o"></i>Delete
</button>
我该如何解决这个问题?
更新回答
@if(isset($users))
@foreach($users as $use)
<h1>{{$use->username}}</h1>
<h1>{{$use->email}}</h1>
@endforeach
@endif
答案 0 :(得分:0)
试试这个会对你有用:
<button class="btn btn-circle btn-danger delete"
data-action="{{url('users')}}/{{$use->id}}"
data-token="{{csrf_token()}}">
<i class="fa fa-trash-o"></i>Delete
</button>