title: Vue returning data objects from axios call to controller
body: <p>I'm using vue in laravel and trying to get a controller function that I'm hitting to return the data so that I can use it in the <code>data()</code> section of my vue template.</p>
  
  <p>I know the controller function returns what I need, but I'm not so sure how I need to handle the return/response in the axios call in order to start placing the data into the data() function in vue</p>
  
  <p>Blade/Vue template</p>
  
  <pre><code>import moment from 'moment'
  export default {
      name: 'calendar',
      data () {
          return {
              events: [
                  {
                      title: 'test',
                      allDay: true,
                      start: '2019-08-17',
                  },
              ],
              config: {
                  defaultView: 'month',
                  eventRender: function(event, element) {
                      console.log(event)
                  }
              },
          }
      },
      created() {
          this.fetchTasks();
      },
      methods: {
        fetchTasks() {
          axios.get('/landing/tasks' )
              .then((response) =&gt; {
                  // handle success
                  this.assetOptions = response.data;
              })
              .catch(function (error) {
                  // handle error
                  console.log(error);
              })
              .finally(function () {
  
          });
      }
  }
  }
  </code></pre>
  
  <p>Route </p>
  
  <pre><code>Route::get('/landing/tasks', 'landingController@getTasks')
      -&gt;name('landing/tasks');
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>public function getTasks()
  {
      $getTask = Task::getTaskForLanding();
  
      $result = array();
      foreach($getTask as $id =&gt; $task){
          $result[$task-&gt;taskt_id][] = $task;
      }
  }
  </code></pre>