I'm using Laravel Excel to export data. I want to get all the reminders attached to a vet, which are accessed over a hasManyThrough relationship.
I have tried the following code
RemindersExport.php
public function collection()
{
$vets = Vet::where('is_active', 1)->get();
foreach($vets as $vet){
$reminders = $vet->reminders();
}
return $reminders;
}
Controller
public function reminders()
{
return Excel::download(new RemindersExport, 'reminders30days.xlsx');
}
I get the following message...
Method Illuminate\Database\Query\Builder::all does not exist.
someModel::all()?