In api.php
I have this 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 this error Uncaught TypeError: Cannot read property 'post' of undefined