** мой маршрутный файл, и когда я набираю непосредственно сообщения в URL, он показывает сообщения, но с созданным методом в app.js ничего не показывает **
Route::get('/posts', function () {
$posts_json = DB::table('posts')
->orderBy('posts.created_at','desc')->take(4)->get();return $posts_json;}
Мой файл app.js
const app = new Vue({
el: '#app',
data: {
msg: 'make post',
content:'',
posts: [],
bUrl: 'http://localhost/pathikhome',
},
ready: function(){
this.created();
},
created(){
axios.get(this.bUrl +'/posts')
.then(response => {
console.log(response);
this.posts = response.data;
})
.catch(function (error) {
console.log(error);
});
},
methods: {
addPost(){
axios.post(this.bUrl +'/addPost', {
content:this.content
})
если не успех
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
}
}});