Skip to content
Permalink
Browse files

Episode 41 Complete

  • Loading branch information...
JeffreyWay committed Apr 12, 2019
1 parent 2385fbc commit 0cea5cbb7daebacfc87a670f6665c85263544585
@@ -46,12 +46,20 @@ public function create()
/**
* Persist a new project.
*
* @return \Illuminate\Http\RedirectResponse
* @return mixed
*/
public function store()
{
$project = auth()->user()->projects()->create($this->validateRequest());
if ($tasks = request('tasks')) {
$project->addTasks($tasks);
}
if (request()->wantsJson()) {
return ['message' => $project->path()];
}
return redirect($project->path());
}
@@ -45,6 +45,17 @@ public function tasks()
return $this->hasMany(Task::class);
}
/**
* Add a task to the project.
*
* @param array $tasks
* @return \Illuminate\Database\Eloquent\Collection
*/
public function addTasks($tasks)
{
return $this->tasks()->createMany($tasks);
}
/**
* Add a task to the project.
*

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -24,5 +24,8 @@
"tailwindcss": "^0.7.3",
"vue": "^2.5.17",
"vue-template-compiler": "^2.5.21"
},
"dependencies": {
"vue-js-modal": "^1.3.28"
}
}
Oops, something went wrong.

0 comments on commit 0cea5cb

Please sign in to comment.
You can’t perform that action at this time.