Skip to content

Instantly share code, notes, and snippets.

@jeffandersen jeffandersen/tasks Secret

Created Dec 13, 2018
What would you like to do?
// ...
use Illuminate\Http\Request;
// Show Tasks
// ...
// Add New Task
Route::post('/task', function (Request $request) {
// Validate input
$validator = Validator::make($request->all(), [
'name' => 'required|max:255',
if ($validator->fails()) {
return redirect('/')
// Create task
$task = new Task;
$task->name = $request->name;
return redirect('/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.