I have a model :
class Group extends Property {
use HasFactory;
protected $appends = ['logo', 'favicon'];
protected $hidden = ['image', 'faviconImage'];
public function getLogoAttribute()
{
return $this->image->url ?? null;
}
public function getFaviconAttribute()
{
return $this->faviconImage->url ?? null;
}
public function image()
{
return $this->hasOne(GroupImage::class, 'group_id');
}
public function faviconImage()
{
return $this->hasOne(GroupImage::class, 'group_id');
}
GroupImage structure
When I tried to call logo in my ressource : $this->logo
I get null, even if I have data in my group_images
table. I should somehow get data based on localKey ?