app/Http/Controllers/Api/Admin/UserController.php
/**
     * Remove the specified resource from storage.
     *
     * @param  string  $uuid
     * @return Response|RedirectResponse
     * @throws AuthorizationException
     */
Remove the specified resource from storage.
@param  string  $uuid
@return Response|RedirectResponse
@throws AuthorizationException
Remove the specified resource from storage . @param string $uuid @return Response|RedirectResponse @throws AuthorizationException
public function destroy(string $uuid): Response|RedirectResponse
    {
        $this->authorize('delete', User::class);
        $user = User::whereUuid($uuid)->first();
        $user->deleteProfilePhoto();
        $user->tokens->each->delete();
        $user->admin?->delete();
        $user->delete();
        activity('admin')
            ->performedOn($user)
            ->causedBy(auth()->user())
            ->log('deleted user');
        return Redirect::route('admin.users.index', [], HttpResponse::HTTP_SEE_OTHER);
    }
public function destroy ( string $ uuid ) : Response | RedirectResponse { $ this -> authorize ( 'delete' , User :: class ) ; $ user = User :: whereUuid ( $ uuid ) -> first ( ) ; $ user -> deleteProfilePhoto ( ) ; $ user -> tokens -> each -> delete ( ) ; $ user -> admin ?-> delete ( ) ; $ user -> delete ( ) ; activity ( 'admin' ) -> performedOn ( $ user ) -> causedBy ( auth ( ) -> user ( ) ) -> log ( 'deleted user' ) ; return Redirect :: route ( 'admin.users.index' , [ ] , HttpResponse :: HTTP_SEE_OTHER ) ; }
Remove the specified resource from storage.
Remove the specified resource from storage .