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


PHP Project::with方法代码示例

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


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

示例1: PublishedProject

 public function PublishedProject()
 {
     $projects = Project::with(['createdBy', 'faculty', 'status'])->whereHas('status', function ($q) {
         $q->where('key', '=', 'published');
     })->get();
     return $projects;
 }
开发者ID:clubttt,项目名称:SuccessModel4,代码行数:7,代码来源:PublishedProjectService.php

示例2: index

 /**
  * Get the homepage content and metadata.
  *
  * @param Request $request
  * @return Response
  */
 public function index(Request $request)
 {
     //Get the projects, eager load the project images and skills
     $projects = Project::with('images', 'skills')->get();
     //Check if the contact submission cookie has been set
     $contacted = $request->cookie('cconf') ? $request->cookie('cconf') : false;
     return view('public.home')->withContacted($contacted)->withProjects($projects);
 }
开发者ID:justincdotme,项目名称:justincdotme,代码行数:14,代码来源:HomeController.php

示例3: show

 /**
  * Show a specific project
  * @param $id
  * @return mixed
  */
 public function show($id)
 {
     // $project = Project::with('timers')->findOrFail($id);
     // This return the first project in the database, not the project with the $id.
     // Query methods (with, first, find, where, etc.) should be called from the facade (Project::)
     // not on the object ($project)
     // return $project->with('timers')->first();
     return Project::with('timers')->findOrFail($id);
 }
开发者ID:JennySwift,项目名称:project-tracker,代码行数:14,代码来源:ProjectsController.php

示例4: index

 /**
  * Display a listing of the resource.
  * GET /projects
  *
  * @return Response
  */
 public function index($society)
 {
     if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society)) {
         $data['society'] = $society;
         $data['projects'] = Project::with('individual')->where('society_id', '=', $society)->orderBy('project')->get();
         return View::make('projects.index', $data);
     } else {
         return view('shared.unauthorised');
     }
 }
开发者ID:bishopm,项目名称:circuit,代码行数:16,代码来源:ProjectsController.php

示例5: contract_gta

 public function contract_gta($id)
 {
     $conType = "General Terms Agreement";
     $topics = Contracttopic::where('contract_type_id', 1)->orderBy('sort_order')->get();
     $project = Project::with('company.addresses')->where('id', $id)->first();
     $company = $project->company;
     $adc = ConsortiumGlobal::where('id', '1')->first();
     //dd($project);
     return view('contracts.contract', compact('conType', 'topics', 'project', 'company', 'adc'));
 }
开发者ID:RHT-Memphis,项目名称:aeroeco,代码行数:10,代码来源:ProjectsController.php

示例6: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $today = date('Y-m-d');
     $indivs = Task::with('individual')->select('individual_id')->groupBy('individual_id')->get();
     foreach ($indivs as $ind) {
         if ($ind->individual->slack != "") {
             $society = $ind->individual->household->society->society . " Methodist Church";
             $otasks = Task::with('project')->where('individual_id', '=', $ind->individual->id)->where('donedate', '=', '')->where('duedate', '<', $today)->orderBy('duedate')->get();
             $itasks = Task::with('project')->where('individual_id', '=', $ind->individual->id)->where('donedate', '=', '')->where('duedate', '=', $today)->orderBy('duedate')->get();
             $projects = Project::with('task')->where('individual_id', '=', $ind->individual->id)->get();
             if (count($itasks) or count($otasks)) {
                 $msg = "Good morning, " . $ind->individual->firstname . "\n\nHere is a list of your overdue/upcoming project tasks:\n\n";
                 if (count($otasks)) {
                     $msg .= "*Overdue tasks*\n\n";
                 }
                 foreach ($otasks as $ot) {
                     $msg .= "_" . $ot->project->project . ":_ " . $ot->description . " (Due: *" . $ot->duedate . "*)\n";
                 }
                 $msg .= "\n";
                 if (count($itasks)) {
                     $msg .= "*Tasks due today*\n\n";
                 }
                 foreach ($itasks as $it) {
                     $msg .= $it->project->project . ": " . $it->description . "\n";
                 }
                 if (count($projects)) {
                     $msg .= "*Summary of your projects*\n\n";
                     foreach ($projects as $project) {
                         $tot = 0;
                         $ovd = 0;
                         foreach ($project->task as $task) {
                             if ($task->donedate == '') {
                                 if ($task->duedate < $today) {
                                     $ovd++;
                                 }
                                 $tot++;
                             }
                         }
                         if ($tot != 0) {
                             $msg .= $project->project . " [Total tasks: " . $tot . "] Overdue: " . round($ovd / $tot * 100) . "%\n";
                         } else {
                             $msg .= $project->project . " [No tasks set yet]\n";
                         }
                     }
                 }
                 $msg .= "\nThank you for the part you are playing in making this happen :)\n\n_" . $society . "_";
                 Helpers::slackmessage($msg, '@' . $ind->individual->slack);
             }
         }
     }
 }
开发者ID:bishopm,项目名称:circuit,代码行数:56,代码来源:ProjectSlack.php

示例7: 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

示例8: get

 public function get($id)
 {
     $project = Project::with(['createdBy', 'faculty', 'status'])->find($id);
     return $project;
 }
开发者ID:clubttt,项目名称:SuccessModel4,代码行数:5,代码来源:UniversityProjectService.php

示例9: makeProOwner

 public function makeProOwner()
 {
     $input = Request::all();
     // project_id,id
     //chk login user is whether project owner or not
     $project = Project::with(['user', 'users'])->find($input['project_id']);
     if ($project) {
         $user = Auth::User()->id;
         $project = $project->toArray();
         $owner = false;
         if ($user == $project['user_id']) {
             $owner = true;
         }
         if (count($project['users']) > 0) {
             foreach ($project['users'] as &$us) {
                 if ($us['is_owner'] && $user == $us['user_id']) {
                     $owner = true;
                 }
             }
         }
         if ($owner) {
             $update = ProjectUser::where('id', $input['id'])->update(['is_owner' => 1]);
             if ($update) {
                 $message = 'Success.';
                 return Response()->json(ResponseManager::getResult($project, 10, $message));
             } else {
                 $message = 'Something went wrong. Please try again.';
                 return Response()->json(ResponseManager::getError('', 10, $message));
             }
         } else {
             $message = 'You are not authorize to do it.';
             return Response()->json(ResponseManager::getError('', 10, $message));
         }
     } else {
         $message = 'You are not authorize to do it.';
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
 }
开发者ID:maineventio,项目名称:newprojectbase,代码行数:38,代码来源:ProjectController.php

示例10: get

 public function get($id)
 {
     $project = Project::with($this->withArr)->find($id);
     return $project;
 }
开发者ID:clubttt,项目名称:SuccessModel4,代码行数:5,代码来源:ProjectService.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $proj_types = \App\Models\Project_Type::all();
     $projects = \App\Models\Project::with('project_type')->get();
     return view('admin.projects.viewAll', ['projects' => $projects, 'types' => $proj_types]);
 }
开发者ID:jardayn,项目名称:portfolio,代码行数:11,代码来源:ProjectsController.php

示例12: function

Route::get('/logout', function () {
    \Illuminate\Support\Facades\Session::flush();
    return \Illuminate\Support\Facades\Redirect::to('/');
})->name('logout');
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    $projects = \App\Models\Project::with('project_type')->get();
    $proj_types = \App\Models\Project_Type::all();
    $clients = \App\Models\Client::all();
    $quotes = \App\Models\Quote::all();
    return view('index', ['projects' => $projects, 'types' => $proj_types, 'quotes' => $quotes, 'clients' => $clients]);
});
Route::resource('messages', 'MessagesController');
Route::post('/sendMessage', ['as' => 'sendMessage', 'uses' => 'MessagesController@store']);
Route::group(['prefix' => 'admin', 'middleware' => 'admincheck'], function () {
    Route::resource('coverletters', 'CoverLettersController');
    Route::resource('project_type', 'ProjectTypesController');
    Route::resource('projects', 'ProjectsController');
    Route::resource('quote', 'QuotesController');
    Route::resource('settings', 'SettingsController');
    Route::resource('clients', 'ClientsController');
    //    Route::resource('messages', 'MessagesController');
开发者ID:jardayn,项目名称:portfolio,代码行数:31,代码来源:routes.php

示例13: mobileIndex

 public function mobileIndex()
 {
     return Project::with(['logo', 'faculty'])->get();
 }
开发者ID:clubttt,项目名称:SuccessModel4,代码行数:4,代码来源:ProjectApiController.php

示例14: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $today = date('Y-m-d');
     $indivs = Task::with('individual')->select('individual_id')->groupBy('individual_id')->get();
     foreach ($indivs as $ind) {
         $society = $ind->individual->household->society->society . " Methodist Church";
         $otasks = Task::with('project')->where('individual_id', '=', $ind->individual->id)->where('donedate', '=', '')->where('duedate', '<', $today)->orderBy('duedate')->get();
         $itasks = Task::with('project')->where('individual_id', '=', $ind->individual->id)->where('donedate', '=', '')->where('duedate', '>', $today)->orderBy('duedate')->get();
         $projects = Project::with('task')->where('individual_id', '=', $ind->individual->id)->get();
         if (count($itasks) or count($otasks)) {
             $msg = "Good morning, " . $ind->individual->firstname . "<br><br>Here is a list of your overdue/upcoming project tasks:<br><br>";
             if (count($otasks)) {
                 $msg .= "Overdue tasks:<br><br>";
             }
             foreach ($otasks as $ot) {
                 $msg .= $ot->project->project . ": " . $ot->description . " (Due: " . $ot->duedate . ")<br>";
             }
             $msg .= "<br>";
             if (count($itasks)) {
                 $msg .= "Tasks due in the next week:<br><br>";
             }
             foreach ($itasks as $it) {
                 $todaydt = new DateTime($today);
                 $interval = $todaydt->diff($it->duedate);
                 if ($interval->format('%R%a') < 8) {
                     $msg .= $it->project->project . ": " . $it->description . " (Due: " . $it->duedate . ")<br>";
                 }
             }
             if (count($projects)) {
                 $msg .= "Summary of your projects:<br><br>";
                 foreach ($projects as $project) {
                     $tot = 0;
                     $ovd = 0;
                     foreach ($project->task as $task) {
                         if ($task->donedate == '') {
                             if ($task->duedate < $today) {
                                 $ovd++;
                             }
                             $tot++;
                         }
                     }
                     if ($tot != 0) {
                         $msg .= $project->project . " [Total tasks: " . $tot . "] Overdue: " . round($ovd / $tot * 100) . "%<br>";
                     } else {
                         $msg .= $project->project . " [No tasks set yet]<br>";
                     }
                 }
             }
             $msg .= "<br>Thank you for the part you are playing in making this happen :)<br><br>" . $society;
             $semail = $ind->individual->household->society->email;
             $name = $ind->individual->firstname . " " . $ind->individual->surname;
             $email = $ind->individual->email;
             $subject = "Project tasks weekly email from " . $society;
             Mail::queue('messages.message', array('msg' => $msg), function ($message) use($name, $email, $subject, $society, $semail) {
                 $message->from($semail, $society);
                 $message->to($email, $name);
                 $message->replyTo($semail);
                 $message->subject($subject);
             });
         }
     }
 }
开发者ID:bishopm,项目名称:circuit,代码行数:67,代码来源:ProjectEmail.php

示例15: listByUser

 public function listByUser($id)
 {
     $user = Auth::user();
     if ($user->all_companies) {
         $projects = Project::with($this->related)->get();
     } else {
         $projects = Project::with($this->related)->where('company_id', $user->company_id)->all();
     }
     foreach ($projects as $pro) {
         $cntParts = ProjectPart::where('project_id', $pro->id)->where('in_project', true)->count();
         $cntMarket = ProjectPart::where('project_id', $pro->id)->where('in_project', true)->where('can_sell', true)->count();
         $pro->in_market = $cntMarket;
         $pro->total_parts = $cntParts;
         if ($cntParts == 0) {
             $pro->percentage = 0;
         } else {
             $pro->percentage = $cntMarket / $cntParts;
         }
     }
     return $projects;
 }
开发者ID:wyrover,项目名称:aeroeco,代码行数:21,代码来源:ProjectsController.php


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