title: 500 internal server error, http post by angularjs
body: <p>I try to do ajax using angularjs but I get 500 internal server error in console.</p>
  
  <p><strong>angular</strong></p>
  
  <pre><code>$scope.submit = function(){
  
  $http.post('shop', {'order_list':  JSON.stringify($scope.order_list)})
    .success(function(data) {
        console.log(data);
    });
  
  }
  </code></pre>
  
  <p><strong>Laravel's Controller</strong></p>
  
  <pre><code>public function addtocart(){
  
      OrderList::unguard();
  
      $order_list_input = json_decode(Input::get('order_list'));
      $order_list = new OrderList;
      $order_list-&gt;order_id =1;
      $order_list-&gt;product_id = $order_list_input-&gt;product_id;
      $order_list-&gt;amount = $order_list_input-&gt;amount;
      $order_list-&gt;total_cost = Prod::find($order_list_input-&gt;product_id)-&gt;price * $order_list_input-&gt;amount;
      $order_list-&gt;save(); //works when I comment this line out.
  
      var_dump($order_list_input);
  
  }
  </code></pre>
  
  <p>I don't get it. I just comment out that line and it works.</p>
  
  <p><strong>Laravel's Model</strong>
      
  
  <pre><code>class OrderList extends Eloquent
  {
  
      protected $table = 'order_lists';
      protected $fillable = array('order_id','product_id','amount','total_cost');
  
      public function order_list_attribute() {
           return $this-&gt;hasMany('Order_list_attribute');
      }
  
      public function product(){
          return $this-&gt;hasOne('Prod');
      }
  
  
  }
  </code></pre>
  
  <p>Thank's for your help :D</p>