Create Route
DevMarketer - Part 11
This will create all routes for a form:
Route::resource('posts', 'PostController');
to check the list of created routes type to the terminal:
$ php artisan route:list
Adding form control
Go to https://laravelcollective.com/docs/master/html#text
if using
{!! Form::open(['route' => 'posts.store']) !!}
{!! Form::close() !!}
then elements should be inside {{ }}
{{ Form::label('title', 'Title:') }}
Set up PostController@store
DevMarketer - Part 12
after pressing submit the form triggers the 'url' or 'route' which is specified in the
Form::open
array
- Validate (Laravel validation automatically stores the $errors to the Flash Session)
- Store to DB
- Save Success message to Flash Session
- Redirect
return redirect()->route('posts.show', $post->id);
Displaying server messages
DevMarketer - Part 13
Create _messages partial including to Main layout.
Javascript validator (Parsley)
DevMarketer - Part 12 1/2
- Add css and js to public folder
- Insert code:
{!! Html::style('css/parsley.css') !!}
{!! Html::script('js/parsley.min.js') !!}