当前位置: 首页>>代码示例>>PHP>>正文


PHP Project::orderBy方法代码示例

本文整理汇总了PHP中app\models\Project::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::orderBy方法的具体用法?PHP Project::orderBy怎么用?PHP Project::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Project的用法示例。


在下文中一共展示了Project::orderBy方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: projects

 public function projects($search = null, $categories = null, $orderby = null, $paginate = true)
 {
     $result = null;
     /**
      * As buscas não são complementares: ou se filtra por termo ou por categoria(s)
      * mas nunca por ambos.
      */
     if ($paginate) {
         /**
          * SEARCH
          * Se existe um termo de busca, retorna a lista filtrada pelo termo
          */
         if (!is_null($search) && !empty($search)) {
             return Project::where('name', 'like', "%{$search}%")->paginate(env('PAGINATION_ITEMS', 10));
         }
         /**
          * CATEGORIES
          * Se existe uma ou mais categoria(s), retorna a lista filtrada por ela(s)
          */
         if (!is_null($categories) && !empty($categories)) {
             /**
              * Compila-se uma lista distinta projetos associados às caregorias informadas
              */
             $projectsFromCategories = DB::table('category_project')->whereIn('category_id', $categories)->distinct()->get(['project_id']);
             $projectIds = [];
             /**
              * Compila-se uma lista apenas com os IDs dos projetos pois
              * a lista acima possui array com objetos: [0 => StdClass('project_id': 1)]
              */
             foreach ($projectsFromCategories as $value) {
                 $projectIds[] = $value->project_id;
             }
             /**
              * Por fim retorna-se a lista dos projetos
              */
             return Project::whereIn('id', $projectIds)->paginate(env('PAGINATION_ITEMS', 10));
         }
         /**
          * ORDER BY
          * Se existe ordenação, retorna a lista ordenada pela instrução recebida
          */
         if (!is_null($orderby) && !empty($orderby)) {
             $order = explode('|', $orderby);
             return Project::orderBy($order[0], $order[1])->paginate(env('PAGINATION_ITEMS', 10));
         }
         /**
          * Caso nem exista nem termo de busca nem categorias, retorna-se a lista completa, paginada.
          */
         return Project::paginate(env('PAGINATION_ITEMS', 10));
     }
     /**
      * Este, sem paginação, visa atender à API
      */
     return Project::where('name', 'like', "%{$search}%")->get();
 }
开发者ID:ronal2do,项目名称:dave_brubeck,代码行数:55,代码来源:ProjectRepository.php

示例2: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $query = Project::orderBy("created_at", "desc");
     $paginate = new PaginateService($query);
     $this->data->projects = $paginate->data();
     $this->data->paging = $paginate->paging();
     if (Request::ajax()) {
         return $this->json();
     }
     return $this->view();
 }
开发者ID:alfrecuellar,项目名称:muebles,代码行数:16,代码来源:ProjectController.php

示例3: index

 public function index()
 {
     $search['text'] = Input::get('search_text');
     $search['type'] = Input::get('search_type');
     if ($search['type'] == 'user') {
         $list = Project::where('manage', 'like', "%{$search['text']}%")->orderBy('id', 'desc')->paginate(15);
     } else {
         if ($search['type'] == 'name') {
             $list = Project::where('name', 'like', "%{$search['text']}%")->orderBy('id', 'desc')->paginate(15);
         } else {
             $list = Project::orderBy('id', 'desc')->paginate(15);
         }
     }
     return View::make('admin.project_list')->withlist($list)->withsearch($search);
 }
开发者ID:snyh,项目名称:just-calc-dstore-info,代码行数:15,代码来源:ProjectController.php

示例4: welcome

 public function welcome()
 {
     if (!Schema::hasTable('settings')) {
         $data['firsttime'] = "yes";
         return view('firsttime', $data)->with('okmessage', 'Please create a user before you can use Connexion');
     }
     $user = Auth::user();
     if ($user and $user->individual_id) {
         $today = date('d-m-Y');
         $data['tasks'] = Task::where('donedate', '=', '')->where('project_id', '<>', 0)->where('individual_id', $user->individual_id)->orderBy('duedate')->get();
         $data['personal'] = Task::where('donedate', '=', '')->where('project_id', '=', 0)->where('individual_id', $user->individual_id)->orderBy('duedate')->get();
         $data['individuals'] = Individual::orderBy('surname')->get();
         $data['projects'] = Project::with('undonetask')->where('individual_id', $user->individual_id)->orderBy('project')->get();
         $data['projectselect'] = Project::orderBy('project')->lists('project', 'id');
         $data['page_title'] = Helpers::getSetting('circuit_name') . " Circuit";
         $data['page_description'] = "Administrator home page";
         $socs = Permission::where('user_id', '=', $user->id)->select('society_id')->get();
         foreach ($socs as $soc) {
             $thissoc = Society::where('id', '=', $soc->society_id)->get();
             $dum['googleCalendarId'] = $thissoc[0]->society_calendar;
             $dum['color'] = $thissoc[0]->calendar_colour;
             $data['cals'][] = $dum;
         }
         $dum['googleCalendarId'] = Helpers::getSetting('circuit_calendar');
         $dum['color'] = 'black';
         $data['cals'][] = $dum;
         if (Helpers::is_online() and $user->googlecalendar != "") {
             $privatecal = new GoogleCalendar();
             $pcals = $privatecal->getTen($user->googlecalendar);
             foreach ($pcals as $pcal) {
                 $pcal['color'] = $user->calendar_colour;
                 $data['pcals'][] = $pcal;
             }
         } else {
             $data['pcals'] = array();
         }
         if (!count($socs)) {
             $soc = strtolower($user->individual->household->society->society);
             return redirect()->action('SocietiesController@show', $soc);
         } else {
             return view('home', $data);
         }
     } elseif ($user) {
         return view('shared.registered');
     } else {
         return view('landingwebpage');
     }
 }
开发者ID:bishopm,项目名称:circuit,代码行数:48,代码来源:HomeController.php

示例5: feed

 public function feed()
 {
     $feed = Feed::make();
     // cache the feed for 60 minutes (second parameter is optional)
     $feed->setCache(0, 'NorthCoastCaresFeed');
     // check if there is cached feed and build new only if is not
     if (!$feed->isCached()) {
         // creating rss feed with our most recent 20 posts
         $organisations = Organisation::orderBy('created_at', 'desc')->take(20)->get();
         $projects = Project::orderBy('created_at', 'desc')->take(20)->get();
         // set your feed's title, description, link, pubdate and language
         $feed->title = 'North Coast Cares';
         $feed->description = 'Community and faith-based organisations working for good on the KZN North Coast';
         $feed->logo = 'https://scontent-cdg2-1.xx.fbcdn.net/hphotos-xta1/v/t1.0-9/12144733_644650369011345_1628028338195896677_n.png?oh=8ec9cc8612020671b85bc1fe338c7213&oe=56C020F3';
         $feed->link = url('feed');
         $feed->setDateFormat('datetime');
         // 'datetime', 'timestamp' or 'carbon'
         $feed->pubdate = date('d-m-Y');
         $feed->lang = 'en';
         $feed->setShortening(true);
         // true or false
         $feed->setTextLimit(400);
         // maximum length of description text
         foreach ($organisations as $organisation) {
             // set item's title, author, url, pubdate, description and content
             if ($organisation->photo != "") {
                 $fulldescrip = "<img height=\"60\" src=\"" . url($organisation->photo) . "\">" . $organisation->description;
             } else {
                 $fulldescrip = $organisation->description;
             }
             $feed->add("New " . strtoupper($organisation->organisationtype) . ": " . $organisation->organisation, "North Coast Cares", url('/organisations/' . $organisation->id), $organisation->created_at, $fulldescrip, $organisation->description);
         }
         foreach ($projects as $project) {
             // set item's title, author, url, pubdate, description and content
             if ($project->photo != "") {
                 $fulldescrip = "<img height=\"60\" src=\"" . url($project->photo) . "\">" . $project->description;
             } else {
                 $fulldescrip = $project->description;
             }
             $feed->add("New PROJECT: " . $project->project, "North Coast Cares", url('/projects/' . $project->id), $project->created_at, $fulldescrip, $project->description);
         }
     }
     // first param is the feed format
     // optional: second param is cache duration (value of 0 turns off caching)
     // optional: you can set custom cache key with 3rd param as string
     return $feed->render('atom');
 }
开发者ID:bishopm,项目名称:ncc,代码行数:47,代码来源:HomeController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $projects = Project::orderBy('created_at', 'desc')->get();
     return view('frontend.projects.index', compact('projects'));
 }
开发者ID:CodeForBrazil,项目名称:PeaceLabs,代码行数:10,代码来源:ProjectsController.php

示例7: getGroupModal

 function getGroupModal(Group $group)
 {
     $data['group'] = $group;
     $data['assistants'] = [0 => ''];
     $users = User::isAssistant()->orderBy('lastname')->get();
     foreach ($users as $user) {
         $data['assistants'][$user->id] = $user->name;
     }
     $data['projects'] = [0 => 'Onbekend'] + Project::orderBy('name')->pluck('name', 'id')->all();
     return $this->modal('Groep bewerken', 'modals.group', $data);
 }
开发者ID:robindv,项目名称:WebDB,代码行数:11,代码来源:StaffController.php

示例8: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     return Project::orderBy('created_at', 'desc')->limit(6)->get();
 }
开发者ID:oarGroupeCesi,项目名称:madera_api,代码行数:9,代码来源:ProjectController.php

示例9: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $lists = Project::orderBy('created_at', 'desc')->get();
     return response()->json($lists);
 }
开发者ID:cookies5127,项目名称:cookiesblog,代码行数:10,代码来源:ProjectController.php

示例10: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data['fin'] = Helpers::mapme('project');
     $data['projects'] = Project::orderBy('project')->get();
     return view('projects.index', $data);
 }
开发者ID:bishopm,项目名称:ncc,代码行数:11,代码来源:ProjectsController.php

示例11: retrieveProject

function retrieveProject()
{
    $results = array();
    $queries = \App\models\Project::orderBy('id', 'desc')->get();
    foreach ($queries as $query) {
        $results[] = ['id' => $query->id, 'value' => $query->title, 'class' => $query->client_id];
    }
    return json_encode($results);
}
开发者ID:berkapavel,项目名称:Laravel5-Time-Tracker-Project-manager,代码行数:9,代码来源:helpers.php


注:本文中的app\models\Project::orderBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。