當前位置: 首頁>>代碼示例>>PHP>>正文


PHP School::orderBy方法代碼示例

本文整理匯總了PHP中School::orderBy方法的典型用法代碼示例。如果您正苦於以下問題:PHP School::orderBy方法的具體用法?PHP School::orderBy怎麽用?PHP School::orderBy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在School的用法示例。


在下文中一共展示了School::orderBy方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 /**
  * 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);
 }
開發者ID:mertindervish,項目名稱:registerbg,代碼行數:12,代碼來源:AdminHomeController.php

示例2: array

$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) {
開發者ID:Robinwist,項目名稱:UXDTalentenTest,代碼行數:31,代碼來源:admin.php

示例3: listSchools

 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;
 }
開發者ID:mertindervish,項目名稱:registerbg,代碼行數:11,代碼來源:School.php

示例4: getAll

 public function getAll()
 {
     return School::orderBy('school_name')->get();
 }
開發者ID:bmadigan,項目名稱:BatchPortal2,代碼行數:4,代碼來源:DbSchoolRepository.php


注:本文中的School::orderBy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。