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

  1. Validate (Laravel validation automatically stores the $errors to the Flash Session)
  2. Store to DB
  3. Save Success message to Flash Session
  4. 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

  1. Add css and js to public folder
  2. Insert code:
{!! Html::style('css/parsley.css') !!}
{!! Html::script('js/parsley.min.js') !!}

results matching ""

    No results matching ""