/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function indexORG()
 {
     #$test  = new \WI\User\User();
     #$test = $test->getTest();
     #$users = User::all();
     #$pagination = false;
     #return view('user::index',compact('users','pagination'));
     //auth()->loginUsingId(2);
     //$users = User::with('role','locale')->paginate(5);
     $users = User::with('roles', 'locale')->paginate(20);
     //all role names as array
     //dc($users[2]->roles->pluck('name')->all());
     //all role names as string
     //dc($users[2]->roles->implode('name',','));
     $pagination = $users instanceof LengthAwarePaginator;
     return view('user::indexORG', compact('users', 'columnNames', 'pagination'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $users = User::all();
     return view('locale::index', compact('users'));
 }
Example #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     //Auth::logout();
     $action = DB::transaction(function () use($id) {
         try {
             $user = User::findOrFail($id);
             User::destroy($id);
             if (request()->ajax()) {
                 $data = ['status' => 'succes', 'statusText' => 'Ok', 'responseText' => 'Gebruiker \'' . $user->name . '\' is verwijderd'];
                 return response()->json($data, 200);
             }
             Flash::success('De gebruiker ' . $id . '');
         } catch (\Exception $e) {
             if (request()->ajax()) {
                 $data = ['status' => 'succes', 'statusText' => 'Fail', 'responseText' => '' . $e->getMessage() . ''];
                 return response()->json($data, 400);
             }
             Flash::error('Delete is mislukt!<br>' . $e->getMessage() . ' ' . $id . '');
         }
     });
     if (request()->ajax()) {
         return $action;
     }
     return redirect()->back();
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //  return redirect()->route('admin::chart.all.index');
     $users = User::all();
     return view('dashboard::index', compact('users'));
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }