当前位置: 首页>>代码示例>>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;未经允许,请勿转载。