'array', ]; /* |-------------------------------------------------------------------------- | FUNCTIONS |-------------------------------------------------------------------------- */ public static function boot() { parent::boot(); static::deleting(function($obj) { if (count((array)$obj->photos)) { foreach ($obj->photos as $item) { \Storage::disk('public')->delete($item['file_path']); } } }); } /* |-------------------------------------------------------------------------- | RELATIONS |-------------------------------------------------------------------------- */ /* |-------------------------------------------------------------------------- | SCOPES |-------------------------------------------------------------------------- */ public function supportEcosystemPartnerCatalog() { return $this->belongsTo(SupportEcosystemPartnerCatalog::class, 'support_ecosystem_partner_catalog_id'); } /* |-------------------------------------------------------------------------- | ACCESSORS |-------------------------------------------------------------------------- */ /* |-------------------------------------------------------------------------- | MUTATORS |-------------------------------------------------------------------------- */ public function setPhotosAttribute($value) { $attribute_name = "photos"; $disk = "public"; $destination_path = "support_ecosystem_partners"; $this->uploadImgMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path); } }