Created
November 18, 2015 09:34
-
-
Save adilshahzad/5635c466756c926d1105 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add a new Task | |
*/ | |
Route::post('/task', function (Request $request){ | |
$validator = Validator::make($request->all(), [ | |
'name' => 'required|max:255', | |
]); | |
if ($validator->fails()) { | |
return redirect('/') | |
->withInput() | |
->withErrors($validator); | |
} | |
// Create The Task... | |
$task = new Task; | |
$task->name = $request->name; | |
$task->save(); | |
return redirect('/'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment