本文整理汇总了PHP中app\Task::fill方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::fill方法的具体用法?PHP Task::fill怎么用?PHP Task::fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Task
的用法示例。
在下文中一共展示了Task::fill方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$a = new Task();
$a->fill(\Input::all());
$a->save();
return redirect()->back();
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param \App\Http\Requests\CreateTaskRequest $request
* @return \Illuminate\Http\Response
*/
public function store(CreateTaskRequest $request)
{
$task = new Task();
$task->fill($request->all());
$task->created_by = \Auth::user()->id;
$task->save();
Event::fire(new TaskAdded($task));
return $task->fresh();
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$validator = $this->validateName();
if ($validator->fails()) {
return $validator->errors()->all();
}
$project_id = $request->get('project_id');
$last_task = Task::where('project_id', '=', $project_id)->orderBy('order', 'desc')->first();
$order_recent = $last_task ? $last_task->order : -1;
$instance = new Task();
$instance->fill($request->all());
$instance->order = $order_recent + 1;
return Project::find($project_id)->tasks()->save($instance);
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Requests\AddTask $request)
{
try {
\DB::beginTransaction();
$task = new Task();
$task->fill($request->only('title', 'description', 'deadline'));
$task->user_id = auth()->user()->id;
$task->save();
\DB::commit();
flash()->success('Task added to list successfully.');
return redirect()->back();
} catch (\Exception $e) {
\DB::rollback();
flash()->error($e->getMessage());
return redirect()->back()->withInput();
}
}