app/Http/Controllers/UserController.php
/**
     * Remove the specified resource from storage.
     *
     * @param  \App\User  $user
     * @return \Illuminate\Http\Response
     */
Remove the specified resource from storage.
Remove the specified resource from storage .
public function destroy(User $user)
    {
        $this->authorize('delete', $user);
        if(request()->wantsJson() || request()->expectsJson()) {
            $redirect = (Auth::user() == $user) ? route('login') : route('users.index');
            $user->delete();
            return [
                'redirect' => $redirect,
                'message' => trans_choice('messages.user_delete_status', 1)
            ];
        }
        if(Auth::user() == $user){
            $user->delete();
            return redirect()->route('login');
        }
    }
public function destroy ( User $ user ) { $ this -> authorize ( 'delete' , $ user ) ; if ( request ( ) -> wantsJson ( ) || request ( ) -> expectsJson ( ) ) { $ redirect = ( Auth :: user ( ) == $ user ) ? route ( 'login' ) : route ( 'users.index' ) ; $ user -> delete ( ) ; return [ 'redirect' => $ redirect , 'message' => trans_choice ( 'messages.user_delete_status' , 1 ) ] ; } if ( Auth :: user ( ) == $ user ) { $ user -> delete ( ) ; return redirect ( ) -> route ( 'login' ) ; } }
Remove the specified resource from storage.
Remove the specified resource from storage .