本文整理汇总了PHP中app\Task::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::find方法的具体用法?PHP Task::find怎么用?PHP Task::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Task
的用法示例。
在下文中一共展示了Task::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: complete
public function complete($id)
{
$task = Task::find($id);
$task->completed_at = Carbon::now();
$task->save();
return redirect('/tasks');
}
示例2: edit
public function edit($id)
{
$param['pageNo'] = 1;
$result = TaskModel::find($id);
$param['tasks'] = $result;
return View::make('company.task.edit')->with($param);
}
示例3: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
$tasks = Task::find($id);
$taskforms = TaskForm::where('task_id', $id)->with('device', 'task')->get();
return view('taskforms.index')->with('tasks', $tasks)->with('taskforms', $taskforms);
}
示例4: destroy
public function destroy($id)
{
$response = Task::find($id)->delete();
if ($response) {
return redirect('/');
}
}
示例5: markComplete
public function markComplete($taskId)
{
$task = Task::find($taskId);
$task->completed = true;
$task->save();
return redirect()->route('tasks');
}
示例6: updateTask
public function updateTask($id)
{
$task = Task::find($id);
$task->update(Input::all());
Flash::success('Task was updated');
return redirect()->back();
}
示例7: update
public function update(Request $request, $id)
{
array_forget($request, "_token");
$all_request = $request->all();
$task = Task::find($id);
foreach ($all_request as $key => $value) {
/*
* remove all underscore contained
* in the edit form field
*/
$key = preg_replace("/^_/", "", $key);
$task->{$key} = $value;
}
if ($task->update()) {
\Session::flash("success_message", "Task Successfully Updated");
} else {
\Session::flash("error_message", "Unexpected Error Task could not be updated");
}
$tasks = Task::all();
if ($request->ajax()) {
response()->json("Task Successfully Updated");
exit;
// return \Redirect::back();
}
return View("taskmanager.index", ['tasks' => $tasks, 'title' => 'Tasks']);
}
示例8: destroy
public function destroy(Request $request, $taskId)
{
$task = Task::find($taskId);
//$this->authorize('destroy', $task);
$task->delete();
return redirect('/tasks');
}
示例9: getDelete
public function getDelete($id)
{
$task = \App\Task::find($id);
$project_id = $task->project_id;
$task->delete();
\Session::flash('flash_message', 'Your task was deleted.');
return redirect('/tasks/show/' . $project_id);
}
示例10: update
public function update($id, Request $request)
{
$task = Task::find($id);
$task->name = $request->name;
$task->address = $request->address;
$task->save();
return redirect('/tasks');
}
示例11: boot
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(Router $router)
{
parent::boot($router);
// Bind Tasks by full object translated from ID
$router->bind('tasks', function ($id) {
return \App\Task::find($id);
});
}
示例12: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$task = Task::find($id);
if (!$task) {
return $this->respondNotFound('Task does not exist');
}
return $this->respond(['data' => $this->taskTransformer->transform($task)]);
}
示例13: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update(Request $request, $task_id)
{
$task = Task::find($task_id);
$task->task = $request->task;
$task->description = $request->description;
$task->save();
return \Response::json($task);
}
示例14: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
// TODO: implement a validation for this method
$arrRet = array("success" => true);
$task = Task::find($id);
$task->delete();
return response()->json($arrRet);
}
示例15: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$task = Task::find($id);
// $task = Task::where('id',$id)->first();
if (!$task) {
return Response::json(['error' => ['message' => 'La tasca no existeix', 'code']], 404);
}
return Response::json([$this->taskTransfomer->transform($task)], 200);
}