I have some problem with Route::resource That means consider following My Route
Route::resource('tasks','TasksController');
Now, I have following store method in My TaskController
public function store(Request $request, $id, Task $task)
{
$task = new Task;
$task->task_name = $request->input('name');
$task->body = $request->input('body');
$task->assign = $request->input('status');
$task->priority = $request->input('status');
$task->duedate = date("Y-m-d", strtotime($request->input("date")));// $request->input('date');
$task->project_id = $id;
$task->save();
}
My problem is can I use Route::resource('tasks','TasksController'); for store method????
答案 0 :(得分:0)
store方法参数应如下所示:
public function store(Request $request)
在此方法中创建任务时,您没有额外的参数,例如$ id或$ Task