O'Reilly logo

Laravel Application Development Blueprints by Halil İbrahim Yılmaz, Arda Kılıçdağı

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating and processing our question form

Now that our structure is ready, we can proceed to create and process our question form.

Creating our questions form

We perform the following steps to create our question form:

  1. First, we need a new route resource for the question form. Open your routes.php file in the app folder and add the following code:
    Route::get('ask',array('as'=>'ask', 'before'=>'user', 
       'uses' => 'QuestionsController@getNew'));
    
    Route::post('ask',array('as'=>'ask_post', 
      'before'=>'user|csrf', 'uses' => 
      'QuestionsController@postNew'));
  2. Now that our resource is defined, we need to add the resource to our top menu for navigation. Open your topmenu.blade.php file under app/views/template, and find the following line:
    {{HTML::linkRoute('logout','Logout',array(), ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required