I am having problem fetching the uri of a nested resource when using vue js. See below code.
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
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1sCfWLa
via IFTTT
Aucun commentaire:
Enregistrer un commentaire