0
In api.php
have that code:
Route::group(['middleware' => 'api'], function() {
Route::post('clube/addClube', function(Request $request) {
return App\clubes::addClube(['name' => $request -> input(['name'])]);
});
});
In my file I have this method:
methods: {
addLine(){
this.list.push({clube: this.clube});
this.$http.post('api/clube/addClube', this.clube);
}
}
And in my Modal clubs.php:
namespace App;
use Illuminate\Database\Eloquent\Model;
class BD extends Model
{
}
And returns that error Uncaught TypeError: Cannot read property 'post' of undefined
I think you need to use
vue-resource
.npm install vue-resource --save
. Em app.js:import VueResource from 'vue-resource';
andVue.use(VueResource);
. It seems that the $http function does not exist– Miguel
Even installing and importing http://prntscr.com/g6e9kc, still error continues.
– Lucas Caresia