title: How to get the data posted in vuejs?
body: <p>I am trying to post some data to the database using vuejs and laravel. below are the code</p>
  
  <p>html part:</p>
  
  <pre><code>  {{ csrf_field() }}
    &lt;div class="field mini"&gt;
      &lt;textarea required v-model="newComment.text" placeholder="Write a comment" id="comment_text" name="comment_text"&gt;&lt;/textarea&gt;
    &lt;/div&gt;
    &lt;button class="ui blue labeled submit icon button" @click.prevent="postComment()"&gt;
      &lt;i class="icon edit"&gt;&lt;/i&gt; Add Reply
    &lt;/button&gt;
  </code></pre>
  
  <p>the Vuejs part</p>
  
  <pre><code>&lt;script&gt;
  Vue.component('comments',{
    template: '#comment-vue-template',
    data:() =&gt; {
  
      return {
          comments: [],
          newComment: {
            'text': ''
          }
      }
    },
    created: function() {
      this.getComments();
    },
    methods: {
      getComments() {
        this.$http.get('/comments').then(response =&gt; {
          this.comments = response.body
        });
        setTimeout(this.getComments,1000);
      },
      postComment() {
        this.$http.post('/comments').then(response =&gt; {
          this.newComment = {
            'text': ''
          };
          this.getComments();
        })
      }
    }
  });
  new Vue({
    el:'#app',
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>the route part(web.php)</p>
  
  <pre><code>Route::resource('comments', 'CommentsController');
  </code></pre>
  
  <p>Routelist</p>
  
  <pre><code>|        | POST      | comments                    | comments.store   | App\Http\Controllers\CommentsController@store                          | web,auth     |                                                                                                                
  |        | GET|HEAD  | comments                    | comments.index   | App\Http\Controllers\CommentsController@index                          | web,auth     |                                                                                                                
  |        | GET|HEAD  | comments/create             | comments.create  | App\Http\Controllers\CommentsController@create                         | web,auth     |                                                                                                                
  |        | GET|HEAD  | comments/{comment}          | comments.show    | App\Http\Controllers\CommentsController@show                           | web,auth     |                                                                                                                
  |        | PUT|PATCH | comments/{comment}          | comments.update  | App\Http\Controllers\CommentsController@update                         | web,auth     |                                                                                                                
  |        | DELETE    | comments/{comment}          | comments.destroy | App\Http\Controllers\CommentsController@destroy                        | web,auth     |                                                                                                                
  |        | GET|HEAD  | comments/{comment}/edit     | comments.edit    | App\Http\Controllers\CommentsController@edit                           | web,auth    
  </code></pre>
  
  <p>and the CommentsController</p>
  
  <pre><code>public function store(Request $request)
  {
    $owner = Auth::User();
    $comment = new Comment;
    $comment-&gt;posted = Carbon::now();
    $comment-&gt;text = $request-&gt;comment_text;
    $comment-&gt;owner = array('id'=&gt;$owner-&gt;id, 'name'=&gt;$owner-&gt;name, 'avatar'=&gt;$owner-&gt;avatar);
    $comment-&gt;save();
  }
  </code></pre>
  
  <p>I tried the api route and the normal route but it does not work. i keep getting </p>
  
  <blockquote>
    <p>statusText:"Internal Server Error" url:"/comments"</p>
  </blockquote>
  
  <p>even when the resource route is present in the web.php. Data gets loaded correctly though. Where is the mistake please. Thank you in advance.</p>