model ->addMediaFromDisk($key, 'public') ->usingFileName($key) ->toMediaCollection($this->collection_name); } protected function casts() { return [ 'created_at' => 'datetime:Y-m-d H:i:s', 'updated_at' => 'datetime:Y-m-d H:i:s', ]; } }