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


PHP Task::with方法代码示例

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


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

示例1: index

 /**
  * 显示当前课程列表
  * @author FuRongxin
  * @date    2016-03-29
  * @version 2.0
  * @return  \Illuminate\Http\Response 教师课程列表
  */
 public function index()
 {
     $tasks = Task::with(['course' => function ($query) {
         $query->select('kch', 'kcmc', 'xs');
     }])->whereJsgh(Auth::user()->jsgh)->whereNd(session('year'))->whereXq(session('term'))->orderBy('kcxh')->get();
     $title = session('year') . '年度' . Term::find(session('term'))->mc . '学期';
     return view('tes.index')->withTitle($title . '课程列表')->withTasks($tasks);
 }
开发者ID:rxfu,项目名称:teacher,代码行数:15,代码来源:TesController.php

示例2: edit

 public function edit($id)
 {
     $user_group = Auth::user()->user_group_id;
     if ($user_group == 1) {
         $tasks = Task::with('component', 'module')->get();
         foreach ($tasks as &$task) {
             $task->list = 1;
             $task->view = 1;
             $task->add = 1;
             $task->edit = 1;
             $task->delete = 1;
             $task->report = 1;
             $task->print = 1;
         }
     } else {
         if ($user_group == $id || $id == 1) {
             $tasks = DB::table('user_group_roles as ugr')->select('ugr.component_id', 'ugr.module_id', 'ugr.task_id', 'ugr.list', 'ugr.view', 'ugr.add', 'ugr.edit', 'ugr.delete', 'ugr.report', 'ugr.print', 'components.name_en as component_name', 'modules.name_en as module_name', 'tasks.name_en as task_name')->join('tasks', 'tasks.id', '=', 'ugr.task_id')->join('components', 'components.id', '=', 'ugr.component_id')->join('modules', 'modules.id', '=', 'ugr.module_id')->where('tasks.route', 'not like', 'roles%')->where('ugr.user_group_id', $id)->where('ugr.list', 1)->get();
         } else {
             $tasks = DB::table('user_group_roles as ugr')->select('ugr.component_id', 'ugr.module_id', 'ugr.task_id', 'ugr.list', 'ugr.view', 'ugr.add', 'ugr.edit', 'ugr.delete', 'ugr.report', 'ugr.print', 'components.name_en as component_name', 'modules.name_en as module_name', 'tasks.name_en as task_name')->join('tasks', 'tasks.id', '=', 'ugr.task_id')->join('components', 'components.id', '=', 'ugr.component_id')->join('modules', 'modules.id', '=', 'ugr.module_id')->where('ugr.user_group_id', $id)->where('ugr.list', 1)->get();
         }
     }
     $roleResult = DB::table('user_group_roles as ugr')->select('ugr.id as ugr_id', 'ugr.list', 'ugr.view', 'ugr.add', 'ugr.edit', 'ugr.delete', 'ugr.report', 'ugr.print', 'ugr.component_id', 'ugr.module_id', 'ugr.task_id')->where('ugr.user_group_id', $id)->orderBy('ugr.component_id', 'asc')->orderBy('ugr.module_id', 'asc')->get();
     $roles = new stdClass();
     $roles->list = [];
     $roles->view = [];
     $roles->add = [];
     $roles->edit = [];
     $roles->delete = [];
     $roles->report = [];
     $roles->print = [];
     $roles->ugr_id = [];
     foreach ($roleResult as $result) {
         $roles->ugr_id[$result->task_id] = $result->ugr_id;
         if ($result->list) {
             $roles->list[] = $result->task_id;
         }
         if ($result->view) {
             $roles->view[] = $result->task_id;
         }
         if ($result->add) {
             $roles->add[] = $result->task_id;
         }
         if ($result->edit) {
             $roles->edit[] = $result->task_id;
         }
         if ($result->delete) {
             $roles->delete[] = $result->task_id;
         }
         if ($result->report) {
             $roles->report[] = $result->task_id;
         }
         if ($result->print) {
             $roles->print[] = $result->task_id;
         }
     }
     return view('roles.edit', compact('tasks', 'roles', 'id'));
 }
开发者ID:saj696,项目名称:pipe,代码行数:57,代码来源:RolesController.php

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

示例4: index

 public function index()
 {
     $tasks = Task::with('component', 'module')->latest()->where('tasks.status', 1)->paginate(Config::get('common.pagination'));
     return view('tasks.index', compact('tasks'));
 }
开发者ID:saj696,项目名称:pipe,代码行数:5,代码来源:TasksController.php

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

示例6: timetable

 /**
  * 显示课程学期列表
  * @author FuRongxin
  * @date    2016-03-18
  * @version 2.0
  * @return  \Illuminate\Http\Response 课程学期列表
  */
 public function timetable()
 {
     $periods = Task::with('term')->whereJsgh(Auth::user()->jsgh)->select('nd', 'xq')->groupBy('nd', 'xq')->orderBy('nd', 'desc')->orderBy('xq', 'desc')->get();
     return view('task.timetable')->withTitle('学期列表')->withPeriods($periods);
 }
开发者ID:rxfu,项目名称:teacher,代码行数:12,代码来源:TaskController.php


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