title: problem in storing data form into database laravel
body: <p>I am trying to store some data in to the database. I have NewMember form this form will have data to be store in 3 tables users, restaurants, and addresses. It is showing the error <code>MethodNotAllowedHttpException in RouteCollection.php line 218:</code>. If I use an insert query with default values it will insert it successfully.<br>
  this is NewMember form </p>
  
  <pre><code>@extends('layouts.app')
  @section('content')
  &lt;style&gt;
     body {
     background-color: #fff0e6;
     }
  &lt;/style&gt;
  &lt;div class="container"&gt;
     &lt;div class="row"&gt;
        &lt;div class="col-md-8 col-md-offset-2"&gt;
           &lt;div class="panel panel-default"&gt;
              &lt;div class="panel-heading"&gt;
                 &lt;h1&gt;&lt;u&gt;&lt;font color="990000" ;&gt;Register new restaurant&lt;/font&gt;&lt;/u&gt;&lt;/h1&gt;
              &lt;/div&gt;
              &lt;div class="panel-body"&gt;
                 &lt;form class="form-horizontal" role="form" method="POST" action="/restaurantmenus/"&gt;
                    &lt;input type="hidden" name="_token" value="{{ csrf_token() }}"&gt;
                    &lt;div class="form-group"&gt;
                       &lt;label for="name" class="col-md-4 control-label"&gt;Restaurant name&lt;/label&gt;
                       &lt;div class="col-md-6"&gt;
                          &lt;input id="name" type="text" class="form-control" name="name"
                             value="{{ old('name') }}"&gt;
                       &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                       &lt;label for="address" class="col-md-4 control-label"&gt;Address&lt;/label&gt;
                       &lt;div class="col-md-6"&gt;
                          &lt;label for="name" class="col-md-4 control-label"&gt;City&lt;/label&gt;
                          &lt;select name="city" style="width: 150px" id="city" class="form-control"&gt;
                             &lt;option value="Damascus"&gt;Damascus&lt;/option&gt;
                          &lt;/select&gt;
                          &lt;br&gt;
                          &lt;label for="name" class="col-md-4 control-label"&gt;Region&lt;/label&gt;
                          &lt;select name="region" style="width: 150px" id="region" class="form-control"&gt;
                             &lt;option value="111"&gt;111&lt;/option&gt;
                             &lt;option value="222"&gt;222&lt;/option&gt;
                          &lt;/select&gt;
                       &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                       &lt;label for="name" class="col-md-4 control-label"&gt;Telephone&lt;/label&gt;
                       &lt;div class="col-md-6"&gt;
                          &lt;input id="Telephone" type="text" class="form-control" name="Telephone"
                             value="{{ old('Telephone') }}"&gt;
                       &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                       &lt;label for="name" class="col-md-4 control-label"&gt;About your restaurant&lt;/label&gt;
                       &lt;div class="col-md-6"&gt;
                          &lt;textarea id="description" rows="4" cols="50" name="description"
                             value="{{ old('description') }}"
                             placeholder="Enter text here..." class="form-control"&gt;&lt;/textarea&gt;
                       &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                       &lt;label for="name" class="col-md-4 control-label"&gt;Email&lt;/label&gt;
                       &lt;div class="col-md-6"&gt;
                          &lt;input id="email" type="email" class="form-control" name="email"
                             value="{{ old('email') }}"&gt;
                       &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                       &lt;label for="name" class="col-md-4 control-label"&gt;Username&lt;/label&gt;
                       &lt;div class="col-md-6"&gt;
                          &lt;input id="username" type="text" class="form-control" name="username"
                             value="{{ old('username') }}"&gt;
                       &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                       &lt;label for="name" class="col-md-4 control-label"&gt;Password&lt;/label&gt;
                       &lt;div class="col-md-6"&gt;
                          &lt;input id="password" type="password" class="form-control" name="password"
                             value="{{ old('password') }}"&gt;
                       &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                       &lt;label for="name" class="col-md-4 control-label"&gt;Confirm password&lt;/label&gt;
                       &lt;div class="col-md-6"&gt;
                          &lt;input id="password2" type="password" class="form-control" name="password2"
                             value="{{ old('password2') }}"&gt;
                       &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                       &lt;label for="name" class="col-md-4 control-label"&gt;Kitchen&lt;/label&gt;
                       &lt;div class="col-md-6"&gt;
                          &lt;select name="kitchen" id="kitchen" class="form-control"&gt;
                             &lt;option value="111"&gt;111&lt;/option&gt;
                             &lt;option value="222"&gt;222&lt;/option&gt;
                          &lt;/select&gt;
                       &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                       &lt;label for="name" class="col-md-4 control-label"&gt;Working time&lt;/label&gt;
                       &lt;div class="col-md-6"&gt;
                          &lt;label for="name" class="col-md-4 control-label"&gt;Open&lt;/label&gt;
                          &lt;input id="open" style="width: 150px" type="time" class="form-control" name="open"
                             value="{{ old('open') }}"&gt;
                          &lt;br&gt;
                          &lt;label for="name" class="col-md-4 control-label"&gt;Close&lt;/label&gt;
                          &lt;input id="close" style="width: 150px" type="time" class="form-control" name="close"
                             value="{{ old('close') }}"&gt;
                       &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="form-group"&gt;
                       &lt;label for="name" class="col-md-4 control-label"&gt;Delivery&lt;/label&gt;
                       &lt;label for="name"&gt;Yes&lt;/label&gt;
                       &lt;input id="delivery" type="checkbox" style="float: left;" name="delivery"
                          value="{{ old('delivery') }}"&gt;
                       &lt;input id="price" style="width: 150px" style="float: left;" placeholder="Delivery price"
                          type="text" name="price" value="{{ old('price') }}"&gt;
                    &lt;/div&gt;
                    &lt;div class="col-md-6 col-md-offset-4"&gt;
                       &lt;button type="submit" class="btn btn-primary"
                          style="background:#990000; border-color:#990000" ;&gt;
                       &lt;i class="fa fa-btn fa-user"&gt;&lt;/i&gt; Register
                       &lt;/button&gt;
                    &lt;/div&gt;
                 &lt;/form&gt;
              &lt;/div&gt;
           &lt;/div&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  &lt;/div&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;footer&gt;
     @extends('layouts.footer')
  &lt;/footer&gt;
  @endsection
  </code></pre>
  
  <p>this is the models 
  restaurant model it has one relationship with the addresses table (the restaurant has many addresses) </p>
  
  <pre><code>&lt;?php
      namespace App;
  
      use Illuminate\Database\Eloquent\Model;
  
      class restaurant extends Model
      {
      //
          protected $fillable=['name','telephone' ,'description','delivery','DeliveryPrice','ownerName','ownerPhone', 'kitchen','open','close'];
  
          public function addresses(){
              return $this-&gt;hasMany('App/address');
          }
      }
  ?&gt;
  </code></pre>
  
  <h2>user model</h2>
  
  <pre><code>&lt;?php
  
      namespace App;
  
      use Illuminate\Foundation\Auth\User as Authenticatable;
  
      class User extends Authenticatable
      {
          /**
           * The attributes that are mass assignable.
           *
           * @var array
           */
          protected $table = 'users';//add
          protected $fillable = [
              'name', 'username','email', 'password','phone',
          ];
  
          /**
           * The attributes that should be hidden for arrays.
           *
           * @var array
           */
          protected $hidden = [
              'password', 'remember_token',
          ];
  
          public function restaurant(){
              return $this-&gt;hasMany('App/restaurant');
          }
      }
  }
  </code></pre>
  
  <h2>addresses model</h2>
  
  <pre><code>       &lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class address extends Model
  {
      //
      protected $fillable=[
         'city','region'
      ];
  }
  </code></pre>
  
  <p>the controller </p>
  
  <p>{  
  
  <pre><code>namespace App\Http\Controllers;
  
  use App\address;
  use App\restaurant;
  use App\User;
  use Illuminate\Http\Request;
  use App\restaurant as restaurantAlias;
  use App\Http\Requests;
  use Illuminate\Support\Facades\Hash;
  use Illuminate\Support\Facades\Input;
  use phpDocumentor\Reflection\DocBlock\Tags\Uses;
  
  class restaurantController extends Controller
  {
      //
      public function index()
      {
          $use=User::all();
          $res=restaurant::all();
          $add=address::all();
          return view('NewMember',compact('use','res','add'));
      }
  
      public function create()
      {
          // $restaurant=restaurant::all();
          // return view('restaurant.NewMember',compact($restaurant));
  
  
          return view('NewMember');
      }
  
  
      /**
       * @param $id
       * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
       */
      public function show()
      {
          // $restaurant1= restaurant::find($id);
  
          // return view('restaurantmenus/',$restaurant1);
          return view('restaurantmenus');
  
      }
  
      public function store(Request $request)
      {
          // taking the restaurant user information
  
          $restaurantUser = new User();
          $restaurantUser-&gt;email = $request-&gt;email;
          $restaurantUser-&gt;username = $request-&gt;username;
          $restaurantUser-&gt;type = 'restaurant';
          $restaurantUser-&gt;password = Hash::make($request-&gt;password);
          $restaurantUser-&gt;save();
  
  
          //taking the restaurant information
          $object = new restaurant();
  
          $object-&gt;name = $request-&gt;name;
          $object-&gt;telephone = $request-&gt;Telephone;
          $object-&gt;description = $request-&gt;description;
          $object-&gt;delivery = $request-&gt;delivery;
          $object-&gt;DeliveryPrice = $request-&gt;DeliveryPrice;
          $object-&gt;kitchen = $request-&gt;kitchen;
          $object-&gt;open = $request-&gt;open;
          $object-&gt;close = $request-&gt;close;
          $object-&gt;user_id = $restaurantUser-&gt;id;
          $object-&gt;$restaurantUser-&gt;save();
          // dd($object-&gt;IDrestaurant);
  
          // taking the restaurant address
          $addr = new address();
          $addr-&gt;city = $request-&gt;city;
          $addr-&gt;region = $request-&gt;region;
          $addr-&gt;restaurant_id = $object-&gt;id;
          $addr-&gt;$object-&gt;$restaurantUser-&gt;save();
  
  
          $idr = $object-&gt;IDrestaurant;
          return redirect('/restaurantmenus/' . $idr);
      }
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>the route I think the problem in the post route .csrf_token() is not allowing the post route to send the data to database. I'd tried to add the routes to  <code>$except</code> in <code>VerifyCsrfToken</code> class but it did not work</p>
  
  <pre><code>   Route::post('/NewMember','restaurantController@store');
     Route::get('/NewMember','restaurantController@create');
     Route::get('/restaurantmenus','restaurantController@show');
  </code></pre>