本文整理汇总了PHP中app\models\Task::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::where方法的具体用法?PHP Task::where怎么用?PHP Task::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Task
的用法示例。
在下文中一共展示了Task::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
*/
public function show(Request $request, $id)
{
if ($request->ajax()) {
return Task::where('trade_id', '=', $id)->get();
}
return view('errors.404');
}
示例2: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$tasks = Task::where('date', '>=', Carbon::parse(date('d-m-Y')))->where('date', '<=', Carbon::parse(date('d-m-Y'))->addDay(7))->orderBy('date', 'asc')->get();
\Mail::send('emails.remainder', ['tasks' => $tasks], function ($m) {
$m->to(env('REMAINDER_EMAIL'), env('REMAINDER_NAME'))->subject('[SUN TASK] Your Task Reminder.');
});
}
示例3: show
/**
* Display the specified resource.
* GET /projects/{id}
*
* @param int $id
* @return Response
*/
public function show($society, $id)
{
$data['society'] = $society;
$project = Project::find($id);
if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society) or $project->individual_id == Auth::user()->individual_id) {
$individuals = Individual::orderBy('surname')->get();
$oldtasks = Task::where('project_id', $id)->where('donedate', '!=', '')->get();
$tasks = Task::where('project_id', $id)->where('donedate', '')->get();
return View::make('projects.show', $data)->with('project', $project)->with('oldtasks', $oldtasks)->with('tasks', $tasks)->with('individuals', $individuals);
} else {
return view('shared.unauthorised');
}
}
示例4: getTaskWithPaginate
/**
* To get tasks with pagination
*
* @param $item
*
* @param $searchKey
*
* @return tasks
*/
public function getTaskWithPaginate($item = 5, $searchKey = '')
{
if (!$searchKey == '') {
$field = strstr($searchKey, '@ ', true);
$value = str_replace("@ ", '', strstr($searchKey, '@ '));
} else {
$field = '';
$value = '';
}
if ($field == 'date') {
$value = Carbon::parse($value);
}
return Task::where($field, 'LIKE', "%{$value}%")->orderBy('date', 'asc')->paginate($item);
}
示例5: task_report
public function task_report($type)
{
// $type = 'week';
$query_begin = null;
$query_end = null;
switch ($type) {
case 'month':
$query_begin = date("Y-m-d", mktime(0, 0, 0, date("m"), 1, date("Y")));
$query_end = date("Y-m-d ", mktime(0, 0, 0, date("m") + 1, 1, date("Y")));
break;
case 'week':
$query_begin = date("Y-m-d", strtotime("-1 week Monday"));
$query_end = date("Y-m-d", strtotime("+0 week Monday"));
break;
default:
$query_begin = date("Y-m-d", mktime(0, 0, 0, date("m"), 1, date("Y")));
$query_end = date("Y-m-d ", mktime(0, 0, 0, date("m") + 1, 1, date("Y")));
break;
}
$tasks_sum = DB::table('tasks')->select(DB::raw('ifnull(sum(case when status = 0 then 1 ELSE 0 end),0) as todo'), DB::raw('ifnull(sum(case when status = 1 then 1 ELSE 0 end),0) as deving'), DB::raw('ifnull(sum(case when status = 2 then 1 ELSE 0 end),0) as testing'), DB::raw('ifnull(sum(case when status > 2 then 1 ELSE 0 end),0) as over'))->where('ekp_create_date', '>', $query_begin)->first();
//TODO:这里的条件,在团队数据和个人数据中是不一样的,团队的用actual_finish_date,个人的用dev、test_end_date
$tasks_workload_sum = DB::table('tasks')->select(DB::raw('sum(developer_workload) as developer_workload_all'), DB::raw('sum(tester_workload) as tester_workload_all'))->where('actual_finish_date', '>', $query_begin)->where('actual_finish_date', '<', $query_end)->first();
$task_details = Task::where('ekp_create_date', '>', $query_begin)->where('ekp_create_date', '<', $query_end)->get();
$query_str = "SELECT b.name,sum(CASE `status` WHEN 0 THEN 1 ELSE 0 END ) AS todo,sum( CASE `status` WHEN 1 THEN 1 ELSE 0 END ) AS doing,sum( CASE `status` WHEN 2 THEN 1 ELSE 0 END ) AS testing,\n sum(CASE `status` WHEN 3 THEN 1 ELSE 0 END ) AS dong,COUNT(1) AS totle FROM tasks a LEFT JOIN users b ON a.developer = b. CODE WHERE developer_start > :begin_time AND developer_start < :end_time AND developer <> '' AND `status` IN (0, 1, 2, 3)\n GROUP BY b. NAME UNION SELECT b. NAME,sum( CASE `status` WHEN 0 THEN 1 when 1 then 1 ELSE 0 END ) AS todo,0 doing, sum( CASE `status` WHEN 2 THEN 1 ELSE 0 END )\n AS testing,sum( CASE `status` WHEN 3 THEN 1 ELSE 0 END ) AS dong,COUNT(1) AS totle FROM tasks a LEFT JOIN users b ON a.tester = b.CODE WHERE tester_start > :begin_time1\n AND tester_start < :end_time1 AND tester <> '' AND tester <> 'xmabu' AND tester <> 'yd' AND `status` IN (0, 1, 2, 3) GROUP BY b. NAME";
// print_r($query_begin);
// print_r($query_end);
//// print_r(date("Y-m-d",mktime(0,0,0,date("m"),1,date("Y"))));
// dd($query_str);die;
$query_params = array('begin_time' => $query_begin, 'end_time' => $query_end, 'begin_time1' => $query_begin, 'end_time1' => $query_end);
$person_workload_totle = DB::select($query_str, $query_params);
$query_str = "select NAME,sum(todo_workload) todo_workload,sum(deving_workload) deving_workload,sum(testing_workload) testing_workload,sum(dong_workload) dong_workload,role,sum(sum_workload) sum_workload from\n (SELECT b. NAME,IFNULL(case `status` when 0 then sum(developer_workload) END,0) todo_workload,IFNULL(case `status` when 1 then sum(developer_workload) END,0) deving_workload,IFNULL(CASE `status` WHEN 2 THEN sum(developer_workload)END,0) as testing_workload,\n IFNULL(case `status` when 3 then sum(developer_workload) END,0) dong_workload,IFNULL(SUM(developer_workload),0) sum_workload, b.role FROM tasks a LEFT JOIN users b ON a.developer = b. CODE\n WHERE developer_start > :begin_time AND developer_start < :end_time AND developer <> '' AND `status` IN (0, 1, 2, 3) GROUP BY b. NAME,\n `status` UNION SELECT b. NAME,IFNULL(case when `status` in (0,1) then sum(tester_workload) end,0) as todo_workload,0 as deving_workload,IFNULL(case when `status`=2 then sum(tester_workload) end,0) as testing_workload,\n IFNULL(case when `status`=3 then sum(tester_workload) end,0) as done_workload,IFNULL(SUM(tester_workload),0) sum_workload,b.role FROM tasks a LEFT JOIN users b ON a.tester = b. CODE WHERE tester_start > :begin_time1\n AND tester_start < :end_time1 AND tester <> '' AND tester <> 'xmabu' AND tester <> 'yd' AND `status` IN (0, 1, 2, 3) GROUP BY b. NAME,\n `status` ) a GROUP BY NAME";
// dd($query_str);die;
$person_workload_sum = DB::select($query_str, $query_params);
// dd($person_workload_sum);die;
//计算团队工作量,前段js浮点运算有bug
$dev_workload = 0;
$test_workload = 0;
foreach ($person_workload_sum as $key => $value) {
if ($value->role) {
$test_workload += $value->sum_workload;
} else {
$dev_workload += $value->sum_workload;
}
}
$page_data = array('mode' => $type, 'tasks_sum' => $tasks_sum, 'tasks_workload_sum' => $tasks_workload_sum, 'task_details' => $task_details, 'person_workload_totle' => $person_workload_totle, 'person_workload_sum' => array('data' => $person_workload_sum, 'dev_workloads' => $dev_workload, 'test_workloads' => $test_workload, 'total_workloads' => $dev_workload + $test_workload));
// dd($page_data);die;
return view('report.main_chart', ['theme' => 'default', 'page_data' => json_encode($page_data), 'task_details' => $task_details]);
}
示例6: 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');
}
}
示例7: tasksSkilledInSelect
/**
* A company has many tasks (list of tasks they use for planner).
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function tasksSkilledInSelect($prompt = '')
{
$array = [];
$trade_count = count($this->tradesSkilledIn);
foreach ($this->tradesSkilledIn as $trade) {
$tasks = Task::where('trade_id', '=', $trade->id)->orderBy('name')->get();
foreach ($tasks as $task) {
if ($task->status) {
if ($trade_count > 1) {
$array[$task->id] = $trade->name . ':' . $task->name;
} else {
$array[$task->id] = $task->name;
}
}
}
}
return $prompt && count($array) > 1 ? $array = array('' => 'Select Task') + $array : $array;
}
示例8: updateInvoice
public static function updateInvoice($invoice)
{
$client = $invoice->client;
if ($invoice->is_deleted && !$invoice->getOriginal('is_deleted')) {
$adjustment = 0;
if (!$invoice->is_quote && !$invoice->is_recurring) {
$adjustment = $invoice->balance * -1;
$client->balance = $client->balance - $invoice->balance;
$client->paid_to_date = $client->paid_to_date - ($invoice->amount - $invoice->balance);
$client->save();
}
$activity = Activity::getBlank();
$activity->client_id = $invoice->client_id;
$activity->invoice_id = $invoice->id;
$activity->activity_type_id = $invoice->is_quote ? ACTIVITY_TYPE_DELETE_QUOTE : ACTIVITY_TYPE_DELETE_INVOICE;
$activity->message = Utils::encodeActivity(Auth::user(), 'deleted', $invoice);
$activity->balance = $invoice->client->balance;
$activity->adjustment = $adjustment;
$activity->save();
// Release any tasks associated with the deleted invoice
Task::where('invoice_id', '=', $invoice->id)->update(['invoice_id' => null]);
} else {
$diff = floatval($invoice->amount) - floatval($invoice->getOriginal('amount'));
$fieldChanged = false;
foreach (['invoice_number', 'po_number', 'invoice_date', 'due_date', 'terms', 'public_notes', 'invoice_footer', 'partial'] as $field) {
if ($invoice->{$field} != $invoice->getOriginal($field)) {
$fieldChanged = true;
break;
}
}
if ($diff != 0 || $fieldChanged) {
$backupInvoice = Invoice::with('invoice_items', 'client.account', 'client.contacts')->find($invoice->id);
if ($diff != 0 && !$invoice->is_quote && !$invoice->is_recurring) {
$client->balance = $client->balance + $diff;
$client->save();
}
$activity = Activity::getBlank($invoice);
$activity->client_id = $invoice->client_id;
$activity->invoice_id = $invoice->id;
$activity->activity_type_id = $invoice->is_quote ? ACTIVITY_TYPE_UPDATE_QUOTE : ACTIVITY_TYPE_UPDATE_INVOICE;
$activity->message = Utils::encodeActivity(Auth::user(), 'updated', $invoice);
$activity->balance = $client->balance;
$activity->adjustment = $invoice->is_quote || $invoice->is_recurring ? 0 : $diff;
$activity->json_backup = $backupInvoice->hidePrivateFields()->toJSON();
$activity->save();
if ($invoice->isPaid() && $invoice->balance > 0) {
$invoice->invoice_status_id = INVOICE_STATUS_PARTIAL;
} elseif ($invoice->invoice_status_id && $invoice->balance == 0) {
$invoice->invoice_status_id = INVOICE_STATUS_PAID;
}
}
}
}
示例9: deletedInvoice
public function deletedInvoice(InvoiceWasDeleted $event)
{
// Release any tasks associated with the deleted invoice
Task::where('invoice_id', '=', $event->invoice->id)->update(['invoice_id' => null]);
}
示例10: forUser
public function forUser(User $user)
{
return Task::where('user_id', $user->id)->orderBy('created_at', 'asc')->get();
}
示例11: task_end_report
/**
* @param $type 季度、月、周
*/
public function task_end_report($type)
{
$query_begin = null;
$query_end = null;
switch ($type) {
case 'month':
$query_begin = date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 1, date("Y")));
$query_end = date("Y-m-d ", mktime(0, 0, 0, date("m") + 1, 1, date("Y")));
break;
case 'week':
$query_begin = date("Y-m-d", strtotime("-1 week Monday"));
$query_end = date("Y-m-d", strtotime("+0 week Monday"));
break;
}
//TODO:这里的条件,在团队数据和个人数据中是不一样的,团队的用actual_finish_date,个人的用dev、test_end_date
$tasks = Task::select('sum(developer_workload) + sum(tester_workload) as workload_all,
sum(developer_workload) as developer_workload_all,
sum(tester_workload) as tester_workload_all')->where('actual_finish_date', '>', $query_begin)->where('actual_finish_date', '<', $query_end) - get();
$tasks_detail = Task::where('actual_finish_date', '>', $query_begin)->where('actual_finish_date', '<', $query_end) - get();
}
示例12: getSitesWithoutStart
/**
* Get List of Site Without Job Starts options for 'select' dropdown in Vuejs format
*/
public function getSitesWithoutStart(Request $request)
{
$allowedSites = Auth::user()->company->reportsToCompany()->siteList('1')->pluck('id')->toArray();
$sites = Site::whereIn('id', $allowedSites)->where('status', '1')->orderBy('name')->get();
$startJobIDs = Task::where('code', 'START')->where('status', '1')->lists('id')->toArray();
$array = [];
$array[] = ['value' => '', 'text' => 'Select site'];
// Create array in specific Vuejs 'select' format.
foreach ($sites as $site) {
$planner = SitePlanner::select(['id', 'site_id', 'task_id'])->where('site_id', $site->id)->orderBy('from')->get();
$found = false;
foreach ($planner as $plan) {
if (in_array($plan->task_id, $startJobIDs)) {
$found = true;
break;
}
}
if (!$found) {
$array[] = ['value' => $site->id, 'text' => $site->name, 'name' => $site->name];
}
}
return $array;
}
示例13: mobile
public function mobile()
{
if (!Cache::has('developers')) {
Cache::forever('developers', User::where('role', 0)->get());
}
if (!Cache::has('testers')) {
Cache::forever('testers', User::where('role', 1)->get());
}
$task_list = Task::where('status', '<', 3)->orderBy('task_no')->get();
return view('task.index', ['theme' => 'default', 'tasks' => $task_list, 'developers' => Cache::get('developers'), 'testers' => Cache::get('testers')]);
}
示例14: get_module_name
public static function get_module_name($route)
{
$module_id = Task::where('route', $route)->value('module_id');
return $module_id;
}
示例15: getById
public function getById($id)
{
$task = Task::where('id', '=', $id)->firstOrFail();
return $task;
}