/**
  * Show a list of all available flights.
  *
  * @return Response
  */
 public function index()
 {
     $users_info = UserInfo::all();
     $out = 'Alamats: ';
     foreach ($users_info as $info) {
         $out = $out . $info->alamat;
     }
     return $out;
     //return view('user.index', ['users' => $users]);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $search = Input::get('search');
     if ($search != null) {
         $users = DB::table('users')->where('name', 'LIKE', '%' . $search . '%')->orWhere('email', 'LIKE', '%' . $search . '%')->paginate(5);
     } else {
         $users = User::paginate(5);
     }
     $userinfo = UserInfo::all();
     return View::make('admin.user.index')->with('users', $users)->with('userinfo', $userinfo);
 }
 function populateUserWeights()
 {
     $users = UserInfo::all();
     $usersWeights = array();
     foreach ($users as $user) {
         $weight = 0;
         if ($user->csci_261 != null) {
             $weight++;
         }
         if ($user->csci_262 != null) {
             $weight++;
         }
         if ($user->csci_306 != null) {
             $weight++;
         }
         if ($user->csci_406 != null) {
             $weight++;
         }
         $usersWeights[$user->user_id] = $weight;
     }
     return $usersWeights;
 }
示例#4
0
    if (Auth::user()->id != $id) {
        return redirect()->back();
        // redirect back if current user tries to access another user
    }
    $user_info = UserInfo::where('user_id', $id)->first();
    $user = User::findorfail($id);
    return view('pages/edit', compact('user', 'user_info'));
});
Route::post('/users/{id}/edit', 'UserController@update');
// Password routes
Route::controllers(['password' => 'Auth\\PasswordController']);
// Admin routes - only accessible by admin user
Route::group(['middleware' => 'App\\Http\\Middleware\\AdminMiddleware'], function () {
    Route::get('/admin', function () {
        $users = User::all();
        $users_info = UserInfo::all();
        $numTeams = count(Team::all());
        $nullteam = UserInfo::where('team_id', null)->first();
        return view('admin.teams', compact('users_info', 'users', 'numTeams', 'nullteam'));
    });
    Route::post('/admin', 'AdminController@generate');
    Route::get('/admin/generate', function () {
        return view('admin.generate');
    });
    Route::get('/admin/users/{id}', function ($id) {
        $user = User::findorfail($id);
        $userinfo = UserInfo::findorfail($id);
        $numTeams = count(Team::all());
        return view('admin.user', compact('user', 'userinfo', 'numTeams'));
    });
    Route::post('/admin/users/{id}', 'AdminController@edit');