app/Http/Controllers/UserController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        $this->authorize('index', Auth::user());
        $users = User::get();
        if(request()->wantsJson() || request()->expectsJson()) {
            return DataTables::of($users)->addColumn('actions', function($user){
                return implode("", [
                    '<a href="' . route('users.edit', $user) . '" class="btn m-btn m-btn--hover-brand m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-edit"></i></a>',
                    '<a href="' . route('users.destroy', $user) . '" class="deleteDataTableRecord btn m-btn m-btn--hover-brand m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-trash"></i></a>',
                ]);
            })->editColumn('role', function ($user) {
                return UserType::getDescription($user->role);
            })->rawColumns(['actions'])->make(true);
        }
        return view('users.index');
    }
public function index ( ) { $ this -> authorize ( 'index' , Auth :: user ( ) ) ; $ users = User :: get ( ) ; if ( request ( ) -> wantsJson ( ) || request ( ) -> expectsJson ( ) ) { return DataTables :: of ( $ users ) -> addColumn ( 'actions' , function ( $ user ) { return implode ( " " , [ '<a href="' . route ( 'users.edit' , $ user ) . '" class="btn m-btn m-btn--hover-brand m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-edit"></i></a>' , '<a href="' . route ( 'users.destroy' , $ user ) . '" class="deleteDataTableRecord btn m-btn m-btn--hover-brand m-btn--icon m-btn--icon-only m-btn--pill"><i class="la la-trash"></i></a>' , ] ) ; } ) -> editColumn ( 'role' , function ( $ user ) { return UserType :: getDescription ( $ user -> role ) ; } ) -> rawColumns ( [ 'actions' ] ) -> make ( true ) ; } return view ( 'users.index' ) ; }
Display a listing of the resource.
Display a listing of the resource .