I wanted to ask you a question. How to access the properties of this in a livewire controller??
When i do:
dd($this->task->updates->files);
i get this error: Property [files] does not exist on this collection instance.
But when i do:
dd($this->task->updates);
i see all collection with file names.
I need read the $this->task->updates->files
because store the filenames for a function to download S3 disk.
The model updates has :
return $this->belongsTo(Task::class);
}```
CodePudding user response:
That is because you have a collection of multiple objects. you can not use relation on collection. You need to iterate that collection and then use property ->files
on that iteration.