'array', 'text3' => 'array', 'text4' => 'datetime', 'text5' => 'datetime', 'text6' => 'datetime', 'text7' => 'datetime' ]; /* |-------------------------------------------------------------------------- | 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 |-------------------------------------------------------------------------- */ public function NewsCatalog() : BelongsTo { return $this->belongsTo('App\Models\NewsCatalog', 'int1', 'id'); } /* |-------------------------------------------------------------------------- | SCOPES |-------------------------------------------------------------------------- */ /* |-------------------------------------------------------------------------- | ACCESSORS |-------------------------------------------------------------------------- */ /* |-------------------------------------------------------------------------- | MUTATORS |-------------------------------------------------------------------------- */ public function setPhotosAttribute($value) { $attribute_name = "photos"; $disk = "public"; $destination_path = "demo_catalogs"; $this->uploadImgMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path); } /** * for datetime picker */ public function setDatetimeAttribute($value) { $this->attributes['datetime'] = \Carbon\Carbon::parse($value); } }