I am having problem fetching the parameter of my route. I am using laravel and vue js
ReservationController.php
public function index($id)
{
$student = Student::with(['sectionSubjects','sectionSubjects.section',
'sectionSubjects.subject'])->findOrFail($id);
return $student->sectionSubjects;
}
all.js
methods:{
fetchSubjects: function(){
var self = this;
this.$http({
url: 'http://localhost:8000/reservation/id/student',
method: 'GET'
}).then(function (reservations){
this.$set('reservations', reservations.data);
console.log('success');
}, function (response){
console.log('failed');
});
}
}
The problem here is, getting the value of the id of this url http://localhost:8000/reservation/id/student. Is there a way to get the id of the parameter of the index() method? Also here's my route list http://ift.tt/25q6BYA
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire