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


PHP Project::leftJoin方法代码示例

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


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

示例1: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Request $request, $id)
 {
     //
     $data = $request->all();
     $id_period = $data['id_period'];
     if ($id == 1) {
         // Add code for load teacher whitout period
         $teachers = \App\Project::leftJoin('registry_projects', function ($join) use($id_period) {
             $join->on('projects.id', '=', 'registry_projects.id_project')->where('registry_projects.id_period', '=', $id_period);
         })->whereNull('registry_projects.id_project')->Where('projects.active', 1)->select('projects.id', 'projects.name')->get()->toJson();
         //	dd($teacher);
     } else {
         // Add code for load teacher whit period
         $teachers = \App\RegistryProject::Join('projects', 'projects.id', '=', 'registry_projects.id_project')->select('registry_projects.id as id_registry_project', 'projects.id', 'projects.name')->Where('registry_projects.id_period', $id_period)->get()->toJson();
     }
     $status = count(json_decode($teachers, true)) > 0 ? true : false;
     if ($request->ajax()) {
         return response()->json(['status' => $status, 'data' => $teachers]);
     }
 }
开发者ID:JJHdez,项目名称:OpenTpmW,代码行数:26,代码来源:RegistryProjectsController.php

示例2: getTop10ProjectsWithMostFeedbacks

 public function getTop10ProjectsWithMostFeedbacks()
 {
     return Project::leftJoin('project_user', 'projects.id', '=', 'project_user.project_id')->select('projects.name', DB::raw('COUNT(project_user.user_id) as aggregate'))->groupBy('id')->orderBy('aggregate', 'DESC')->limit(10)->get()->toJSON();
 }
开发者ID:jtrupina,项目名称:mobile-app-challenge-2015-web,代码行数:4,代码来源:StatisticsRepository.php

示例3: projects

 /**
  * Projects associated with the user
  *
  * Returns a Builder instance rather than a relation because of
  * the manual left join to client_user. A hasManyThrough relation
  * would not work because of the many-to-many relationship between
  * users and clients.
  *
  * @return Builder
  */
 public function projects()
 {
     $query = Project::leftJoin('client_user', 'client_user.client_id', '=', 'projects.client_id');
     $query->where('client_user.user_id', $this->getKey());
     return $query;
 }
开发者ID:lovett,项目名称:toils,代码行数:16,代码来源:User.php

示例4: opciones

 public function opciones()
 {
     $projects = Project::leftJoin('homes', 'homes.project_id', '=', 'projects.id')->select('projects.*', DB::raw('count(*) as n_casas'))->groupBy('projects.id')->get();
     return view('admin.project.option', compact('projects'));
 }
开发者ID:JohanArmando,项目名称:ProyectoGrado,代码行数:5,代码来源:ProjectController.php


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