/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $statistics = (object) array('schools_count' => School::all()->count(), 'municipalities_count' => Municipality::all()->count(), 'visitor_likes_count' => VisitorLikes::all()->count(), 'visitor_comments_count' => VisitorComments::all()->count());
     $home_schools = School::orderBy('created_at', 'desc')->take(5)->get();
     $home_comments = VisitorComments::orderBy('created_at', 'desc')->take(5)->get();
     return View::make('admin.home')->with('home_schools', $home_schools)->with('home_comments', $home_comments)->with('statistics', $statistics);
 }
Esempio n. 2
0
$data = array();
$data['base_url'] = '/admin/';
$data['current_url'] = rtrim($data['base_url'], '/') . $app->request->getResourceUri();
$data['mainmenu'] = array(array('title' => 'Dashboard', 'url' => 'dashboard', 'icon' => 'fa-dashboard'), array('title' => 'Gebruikers', 'url' => 'users_overview', 'icon' => 'fa-users'), array('title' => 'Scholen', 'url' => 'schools_overview', 'icon' => 'fa-university'), array('title' => 'Talenten', 'url' => 'talents_overview', 'icon' => 'fa-tasks'), array('title' => 'Vaardigheden', 'url' => 'skills_overview', 'icon' => 'fa-sliders'), array('title' => 'Beroepen', 'url' => 'occupations_overview', 'icon' => 'fa-briefcase'), array('title' => 'Uitloggen', 'url' => 'logout', 'icon' => 'fa-lock'));
$app->notFound(function () use($app, $data) {
    $app->render('404.html', $data);
});
$app->get('/dashboard(/:school_id)', function ($school_id = null) use($app, $data) {
    $data['active_school_id'] = $school_id;
    if ($school_id == null) {
        $users = User::with('talents', 'skills', 'educationLevel')->get();
    } else {
        $users = User::with('talents', 'skills', 'educationLevel')->where('school_id', '=', (int) $school_id)->get();
    }
    $occupations = Occupation::all();
    $schools = School::orderBy('name', 'ASC')->get();
    $talents = Talent::all();
    $data['schools'] = $schools->toArray();
    $data['total_occupations'] = $occupations->count();
    $data['total_users'] = $users->count();
    $users_male = $users->filter(function ($user) {
        return $user->gender == 'm';
    });
    $users_female = $users->filter(function ($user) {
        return $user->gender == 'f';
    });
    $data['users_gender'] = array(array('label' => 'vrouw', 'value' => $users_female->count()), array('label' => 'man', 'value' => $users_male->count()));
    // Get amount of people picking talents
    $picked_talents = array();
    $users->each(function ($user) use(&$picked_talents) {
        $user->talents->each(function ($talent) use(&$user, &$picked_talents) {
Esempio n. 3
0
 public static function listSchools()
 {
     if (Auth::user()->hasRole('admin') == true || Auth::user()->hasRole('moderator') == true) {
         $schools_data = School::orderBy('created_at', 'desc')->get();
     } else {
         $schools_data = School::orderBy('created_at', 'desc')->whereHas('users', function ($q) {
             $q->where('user_id', '=', Auth::user()->id);
         })->get();
     }
     return $schools_data;
 }
 public function getAll()
 {
     return School::orderBy('school_name')->get();
 }