private function getGenders()
 {
     $genders_rs = Gender::orderBy('name', 'asc')->get();
     $genders = [0 => 'Choose a gender'];
     foreach ($genders_rs as $g) {
         $genders[$g->id] = $g->name;
     }
     return $genders;
 }
Example #2
0
 */
Route::get('records', 'RecordController@index');
Route::resource('record', 'RecordController');
/**
 * Display All Users
 */
Route::get('/users', function () {
    // Roles
    $roles_rs = Role::orderBy('name', 'asc')->get();
    $roles = [];
    $roles[0] = 'Choose a roles';
    foreach ($roles_rs as $r) {
        $roles[$r->id] = $r->name;
    }
    // Genders
    $genders_rs = Gender::orderBy('name', 'asc')->get();
    $genders = [];
    $genders[0] = 'Choose a gender';
    foreach ($genders_rs as $g) {
        $genders[$g->id] = $g->name;
    }
    // Clubs
    $clubs_rs = Club::orderBy('name', 'asc')->get();
    $clubs = [];
    $clubs[0] = 'Choose a club';
    foreach ($clubs_rs as $c) {
        $clubs[$c->id] = $c->name;
    }
    $users = User::orderBy('created_at', 'asc')->get();
    return view('users', ['title' => 'Users', 'clubs' => $clubs, 'genders' => $genders, 'roles' => $roles, 'users' => $users]);
});