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


PHP Project::orderBy方法代码示例

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


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

示例1: getData

 /**
  * [getData]
  * @return [type] [description]
  */
 public function getData()
 {
     $Model = $this->modelName;
     $all_reminders = $Model::all($this->dataTableColumns);
     $data = [];
     foreach ($all_reminders as $reminder) {
         // load relations
         $load_curr_project = $reminder->project;
         $load_curr_user = $reminder->user;
         $curr_reminder = $reminder;
         Debugbar::info($reminder);
         if (isset($reminder->user_id) && isset($reminder->project_id)) {
             $curr_proj = (object) ['id' => $reminder->reminder_id, 'name' => $reminder->project->name];
             $curr_user = (object) ['id' => $reminder->user_id, 'username' => $reminder->user->username];
             $curr_entry = (object) ['DT_RowId' => 'row_' . $reminder->id, 'reminders' => $curr_reminder, 'users' => $curr_user, 'projects' => $curr_proj];
             $data[] = $curr_entry;
         }
     }
     $all_projects = Project::orderBy('name', 'DESC')->get(['id', 'name']);
     $projects = [];
     foreach ($all_projects as $project) {
         $tmp_project = (object) ['value' => $project->id, 'label' => $project->name];
         $projects[] = $tmp_project;
     }
     $all_users = User::all(['id', 'username']);
     $users = [];
     foreach ($all_users as $user) {
         $tmp_user = (object) ['value' => $user->id, 'label' => $user->username];
         $users[] = $tmp_user;
     }
     $ret = ['data' => $data, 'projects' => $projects, 'users' => $users];
     return Response::json($ret);
 }
开发者ID:strikles,项目名称:php,代码行数:37,代码来源:AdminReminderController.php

示例2: getProjects

 private function getProjects()
 {
     $projects = [];
     foreach (\Project::orderBy('title', 'ASC')->get() as $project) {
         $projects[$project['id']] = $project['title'];
     }
     return $projects;
 }
开发者ID:r8j3,项目名称:phragile,代码行数:8,代码来源:SprintNotFoundActionHandler.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Input::get('search') == null || Input::get('search') == '') {
         $projects = Project::orderBy('created_at', 'DESC')->paginate(5);
     } else {
         $projects = Project::where('title', 'like', '%' . Input::get('search') . '%')->orderBy('projects.created_at', 'DESC')->paginate(5);
     }
     return View::make('admin/projects/index', compact('projects'));
 }
开发者ID:bktz,项目名称:cup,代码行数:14,代码来源:AdminProjectController.php

示例4: getAllProjects

 public function getAllProjects()
 {
     $all_projects = Project::orderBy('name', 'ASC')->get(['id', 'name', 'company_id']);
     $projects = [];
     foreach ($all_projects as $project) {
         $projects[] = (object) ['value' => $project->id, 'label' => utf8_encode($project->company_id . '|' . $project->name)];
     }
     return $projects;
 }
开发者ID:strikles,项目名称:php,代码行数:9,代码来源:traitGetAll.php

示例5: index

 public function index()
 {
     $projects = Project::orderBy('sortorder')->get();
     $miscs = Misc::all();
     $bio = Misc::where('name', '=', 'bio')->firstOrFail();
     $resumeURL = Misc::where('name', '=', 'resumeURL')->firstOrFail();
     $githubURL = Misc::where('name', '=', 'githubURL')->firstOrFail();
     return View::make('projects.index')->with('projects', $projects)->with('bio', $bio)->with('resumeURL', $resumeURL)->with('githubURL', $githubURL);
 }
开发者ID:jcstrandburg,项目名称:portfoliowriter,代码行数:9,代码来源:ProjectsController.php

示例6: paginate

 /**
  * Get paginated projects.
  *
  * @param int  $page  Number of projects per page
  * @param int  $limit Results per page
  * @param bool $all   Show published or all
  *
  * @return StdClass Object with $items and $totalItems for pagination
  */
 public function paginate($page = 1, $limit = 10, $all = false)
 {
     $result = new \StdClass();
     $result->page = $page;
     $result->limit = $limit;
     $result->totalItems = 0;
     $result->items = array();
     $query = $this->project->orderBy('created_at', 'DESC')->where('lang', $this->getLang());
     $projects = $query->skip($limit * ($page - 1))->take($limit)->get();
     $result->totalItems = $this->totalProjects();
     $result->items = $projects->all();
     return $result;
 }
开发者ID:noikiy,项目名称:fullycms,代码行数:22,代码来源:ProjectRepository.php

示例7: show

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function show($page = NULL)
 {
     parent::show();
     if (is_numeric($page)) {
         $page = Page::find($page);
     }
     if ($page == NULL) {
         return View::make('404', compact('settings'));
     }
     $projects = Project::orderBy('id', 'asc')->paginate(2);
     $seo = $page->seo;
     $banner = TRUE;
     return View::make('pages.show', compact('page', 'banner', 'settings', 'seo', 'projects'));
 }
开发者ID:jboz62,项目名称:cms,代码行数:19,代码来源:PagesController.php

示例8: getData

 /**
  * [getData - get all projects data for DT]
  * @return [json] [DT compatible object]
  */
 public function getData($model = null)
 {
     $Model = $this->modelName;
     $num_skip = 0;
     $num_items = 10;
     $recordsTotal = 0;
     $recordsFiltered = 0;
     if (isset($_GET['start'])) {
         $num_skip = (int) $_GET['start'];
     }
     if (isset($_GET['length'])) {
         $num_items = (int) $_GET['length'];
     }
     if (isset($_GET['search'])) {
         $search_value = $_GET['search']['value'];
     }
     $all_projects = Project::orderBy('projects.id', 'DESC');
     if ($model !== null) {
         $all_projects->where('projects.company_id', '=', (int) $model->id);
         if (!empty($search_value)) {
             $all_projects->whereRaw("(projects.name LIKE '%" . $search_value . "%')");
         }
     } else {
         if (!empty($search_value)) {
             $all_projects->join('companies', 'projects.company_id', '=', 'companies.id')->whereRaw("(projects.name LIKE '%" . $search_value . "%' OR companies.bedrijfsnaam LIKE '%" . $search_value . "%')");
         }
     }
     $recordsTotal = $all_projects->count();
     $recordsFiltered = $recordsTotal;
     if ($num_skip > 0) {
         $all_projects->skip($num_skip);
     }
     $all_projects = $all_projects->take($num_items)->get();
     Debugbar::info(count($all_projects));
     $data = [];
     foreach ($all_projects as $project) {
         // load relations
         $load_curr_company = $project->company;
         $curr_company = $project->company !== NULL ? (object) ['id' => $project->company_id, 'bedrijfsnaam' => utf8_encode($project->company->bedrijfsnaam)] : (object) null;
         $data[] = (object) ['DT_RowId' => 'row_' . $project->id, 'projects' => $project, 'companies' => $curr_company];
     }
     $ret = ['data' => $data, 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'companies' => $this->getAllCompanies()];
     return Response::json($ret);
 }
开发者ID:strikles,项目名称:php,代码行数:48,代码来源:AdminProjectController.php

示例9: function

    }
}
Route::get('thumbtest', function () {
    $images = Image::all();
    $html = "";
    foreach ($images as $image) {
        $source = $image->url;
        $dest = public_path() . "/thumbs/" . $image->id . ".jpg";
        $html .= "Source: " . $image->url . " --- Dest: {$dest}<br>";
        make_thumb($source, $dest, 100);
    }
    return $html;
});
Route::get('publish', function () {
    ob_start();
    $projects = Project::orderBy('sortorder')->get();
    $bio = Misc::where('name', '=', 'bio')->firstOrFail();
    $resumeURL = Misc::where('name', '=', 'resumeURL')->firstOrFail();
    $githubURL = Misc::where('name', '=', 'githubURL')->firstOrFail();
    $images = Image::all();
    foreach ($images as $image) {
        $source = $image->url;
        $dest = public_path() . "/thumbs/{$image->id}.jpg";
        echo "Writing thumbnail {$dest}...";
        if (make_thumb($source, $dest, 200)) {
            echo "success";
            $image->thumbnail = asset("thumbs/{$image->id}.jpg");
        } else {
            echo "failure";
            $image->thumbnail = $source;
        }
开发者ID:jcstrandburg,项目名称:portfoliowriter,代码行数:31,代码来源:routes.php

示例10: getExamples

 /**
  * @param int $limit
  * @return mixed
  */
 public function getExamples($limit = 4)
 {
     return $this->project->orderBy('date', 'desc')->take($limit)->get();
 }
开发者ID:jaffle-be,项目名称:framework,代码行数:8,代码来源:PortfolioRepository.php


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