本文整理汇总了PHP中app\Task::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::where方法的具体用法?PHP Task::where怎么用?PHP Task::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Task
的用法示例。
在下文中一共展示了Task::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTaskInfo
/**
* 返回基本信息
* @param $id
*/
public static function getTaskInfo($id)
{
$model = Task::where("id", $id)->get();
$att_arr = $model[0]->attributes;
unset($att_arr['id']);
return $att_arr;
}
示例2: put
public function put($done, Task $task)
{
//echo $done."<br>";
//var_dump($task);
//echo "hallo";
//var_dump($request-done);
//echo $done ."<br>";
//var_dump($task->id);
//echo $task->id;
//$task->done();
//$task->done($done);
//var_dump($task->done);
//echo "hallo";
//Task->done($task-id) = $request->name;
//$numberOfDone = Task::findOrFail($task->id)->done(1);
//$numberOfDone = Task::update(array('done' => 1));
//echo $numberOfDone;
//Task::findOrFail($task->id)->done->save();
//var_dump($taskss);
//var_dump(Task->done;
//echo "hallo";
/*
$taskssss = Task::where('user_id', $request->user()->id)->get();
foreach ($taskssss as $task){
echo $task->done;
}
*/
//return redirect('/tasks');
Task::where('id', $task->id)->update(['done' => $done]);
return redirect('/tasks');
}
示例3: index
/**
* ユーザーの全タスクをリスト表示
*
* @param Request $request
* @return Response
*/
public function index(Request $request)
{
#$tasks = Task::where('user_id', $request->user()->id)->get();
// ページネーション
$tasks = Task::where('user_id', $request->user()->id)->paginate(3);
return view('tasks.index', ['tasks' => $tasks]);
}
示例4: search
public function search(Request $request)
{
$results = array();
$term = $request->get('term');
$goals = Goal::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
$objectives = Objective::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
$actions = Action::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
$tasks = Task::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
$teams = Team::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
$departments = Department::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
$users = User::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get()->all();
foreach (User::where('email', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get() as $matching_user_email) {
if (in_array($matching_user_email, $users)) {
continue;
}
$users[] = $matching_user_email;
}
$notes = Note::where('content', 'like', '%' . $term . '%')->orderBy('content', 'asc')->get();
$types = [$goals, $objectives, $actions, $tasks, $teams, $departments, $users, $notes];
foreach ($types as $type) {
foreach ($type as $result) {
$results[] = $result;
}
}
return view('search.show')->with('results', $results)->with('term', $term);
}
示例5: checkTasks
public static function checkTasks()
{
$finished_tasks = Task::where('finished_at', '<=', Carbon::now())->orWhere('type', 20)->orderBy('finished_at', 'asc')->get();
$finished_tasks->each(function ($task) {
self::finishTask($task);
});
}
示例6: show
/**
* Display the specified resource.
*
* @param $timeCardHoursWorkedId
*
* @return \Illuminate\Http\Response|\Illuminate\View\View
*/
public function show($timeCardHoursWorkedId)
{
// set appGlobal.clientId to current view, otherwise 'if (appGlobal.clientId)' in TimeCard.js causes a js load failure.
appGlobals::populateJsGlobalClient();
// used for routing.
appGlobals::setSessionVariableAppGlobalTimeCardTableName($timeCardHoursWorkedId);
// get all task for a specific time_card.date.
/* @noinspection PhpUndefinedMethodInspection */
$tasks = Task::where('time_card_hours_worked_id', '=', $timeCardHoursWorkedId)->get()->sortBy('start_time');
// derive total hours worked.
$totalHoursWorked = 0;
foreach ($tasks as $task) {
$totalHoursWorked += $task->hours_worked;
}
// eager load task_type for each task.
/* @noinspection PhpUndefinedMethodInspection */
$tasks->load('taskType');
// get time_card data.
/* @noinspection PhpUndefinedMethodInspection */
$timeCard = TimeCardHoursWorked::where('id', '=', $timeCardHoursWorkedId)->get();
// check if $timeCardHoursWorkedId exists, if not return 404 message.
if (count($timeCard) == 0) {
abort(404, 'Your Task ID does not exist.');
}
// pass the data to the view.
return view('pages.userTaskView')->with('tasks', $tasks)->with('timeCard', $timeCard)->with('timeCardHoursWorkedId', $timeCardHoursWorkedId)->with('totalHoursWorked', $totalHoursWorked);
}
示例7: postDeleteComplete
public function postDeleteComplete(Request $request)
{
$tasks = \App\Task::where('list_id', $request->list_id)->where('complete', 1)->get();
foreach ($tasks as $task) {
$task->delete();
}
}
示例8: postTask
function postTask(Request $request)
{
$task = $request->all();
Task::create($task);
$comm = Committee::where('id', $task['comm_id'])->first();
$evnt = Event::where('id', $comm['event_id'])->first();
//UPDATING WEIGHT OF COMMITTEE AND EVENT
$comm->increment('weight', $task['weight']);
$evnt->increment('weight', $task['weight']);
//UPDATING PROGRESS OF COMMITTEE
$progress = 0;
$tasks = Task::where('comm_id', $comm->id)->get();
foreach ($tasks as $task1) {
$progress += $task1->weight * $task1->progress;
}
$progress = $progress / $comm->weight;
$comm->progress = $progress;
$comm->save();
//UPDATING PROGRESS OF EVENT
$progress2 = 0;
$committees = Committee::all();
foreach ($committees as $committee) {
if ($committee->event_id == $evnt->id) {
$progress2 += $committee->weight * $committee->progress;
}
}
$progress2 = $progress2 / $evnt->weight;
$evnt->progress = $progress2;
$evnt->save();
return redirect('profile');
}
示例9: index
public function index(Request $request)
{
echo "hallo controller tasks";
//return view('tasks.index');
$tasks = Task::where('user_id', $request->user()->id)->get();
//hier waren verkeerde variabelen doorgegeven.
return view('tasks.index', ['tasks' => $tasks]);
}
示例10: findByUser
/**
* new query to find all user's tasks
* @param [type] $id [description]
* @return [type] [description]
*/
public static function findByUser($id)
{
$task = Task::where('id', $id)->where('user_id', Auth::id())->first();
if (!$task) {
throw new ModelNotFoundException();
}
return $task;
}
示例11: clearComplete
public function clearComplete()
{
$tasks = \App\Task::where('is_complete', true)->get();
foreach ($tasks as $task) {
$task->delete();
}
return redirect('/');
}
示例12: checkIfEndTimeOverLaps
public function checkIfEndTimeOverLaps($timeCardId, $endTime)
{
$val = Task::where('time_card_hours_worked_id', '=', $timeCardId)->where('start_time', '<', $endTime)->where('end_time', '>=', $endTime)->first();
if (is_null($val)) {
return false;
}
return true;
}
示例13: getWhitelist
public static function getWhitelist($user, $tasks)
{
$whitelist = $tasks->diff($user->taskExemptions->pluck('task_id'));
if (($bad = Task::where('slug', 'recycling')->first()->id) && $tasks->contains($bad) && !$user->canDoRecycling()) {
$whitelist->pull($whitelist->search($bad));
}
return $whitelist;
}
示例14: delete
public function delete($id)
{
TaskModel::where('project_id', $id)->delete();
ProjectModel::where('id', $id)->delete();
$alert['msg'] = 'Project has been deleted successfully';
$alert['type'] = 'success';
return Redirect::route('project')->with('alert', $alert);
}
示例15: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$statuses = [];
foreach (Status::paginate() as $status) {
$statuses[$status->id] = $status->name;
}
$data = ['tasks' => Task::where('user_id', $request->user()->id)->paginate(), 'statuses' => Status::paginate()];
return view('task.index')->with($data);
}