matheenulla
1 week ago
125
7
Laravel

Property [academic_id] does not exist on this collection instance

Posted 1 week ago by matheenulla

Hi

I am using an API resource. I am getting this error in collection instance

  $timetables = TimetableResource::collection(DB::table('time_tables')
        ->whereIn('academic_id', $ids)
        ->whereIn('class', $classid)->get()->groupBy('day'));

and my TimetableResource file

 public function toArray($request)
{
    return [
        'academic_id' => $this->academic_id,
        'day' => $this->day,
        'class' => Course::find($this->class),
        'subject' => Subject::find($this->subject),
        'teacher' => Teacher::find($this->teacher),
        'timeslot' => $this->timeslot

    ];
}

Please sign in or create an account to participate in this conversation.