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


PHP Project::join方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $projects = Project::join('project_resident', 'project_resident.project_id', '=', 'projects.id')->join('residents', 'residents.id', '=', 'project_resident.resident_id')->where('residents.id', '=', Auth::user()->id)->get(['projects.*']);
     $etapas = stage::all();
     return view('residente.avance', compact('projects', 'etapas'));
 }
开发者ID:JohanArmando,项目名称:ProyectoGrado,代码行数:11,代码来源:AvanceController.php

示例2: actualizar

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function actualizar(Request $request)
 {
     $data = $request->all();
     $change = Activity_Stage::where('activity_id', '=', $data['activity_id'])->where('stage_project_id', '=', $data['stage_project_id'])->first();
     $change->fill($data);
     $change->material = $data['material'];
     $change->save();
     $project = Project::join('project_stage', 'project_stage.project_id', '=', 'projects.id')->join('activity_stage', 'activity_stage.stage_project_id', '=', 'project_stage.id')->where('project_stage.id', '=', $data['stage_project_id'])->get(['projects.*']);
     $project = Project::find($project->first()->id);
     $all = Activity_Stage::join('project_stage', 'project_stage.id', '=', 'activity_stage.stage_project_id')->join('projects', 'projects.id', '=', 'project_stage.project_id')->where('projects.id', '=', $project->id)->get(['activity_stage.*']);
     $valor_total = 0;
     foreach ($all as $a) {
         $valor = 0;
         $valor += $a->hand + $a->transport + $a->material;
         $valor_total += $valor * $a->quantity;
     }
     $project->budget = $valor_total;
     $project->save();
     return response()->json([$all]);
 }
开发者ID:JohanArmando,项目名称:ProyectoGrado,代码行数:27,代码来源:ActividadPorEtapaController.php


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