'array', 'mimetypes' => 'array', ]; public function files() { return $this->hasMany(File::class); } protected function exts(): Attribute { return Attribute::make( set: fn ($value) => json_encode($value), ); } public function rules(): array { return [ 'name' => ['max:100', 'Required', 'string', 'unique:collections,name'], "path" => ['max:255', 'nullable', 'string'], "public" => ['nullable', 'boolean'], "disk" => ['required', 'string', 'max:255'], "count" => ['required', 'numeric', 'max:255'], "tmp_support" => ['required', 'boolean'], "remove_tmp_time" => ['date_format:Y-m-d H:i:s', 'nullable'], "max_file_size" => ['nullable', 'numeric'], "min_file_size" => ['nullable', 'numeric'], "max_width" => ['nullable', 'numeric'], "min_width" => ['nullable', 'numeric'], "max_height" => ['nullable', 'numeric'], "min_height" => ['nullable', 'numeric'], "alt_required" => ['required', 'boolean'], "description_required"=> ['required','boolean'], "exts" => ['nullable'], "ext" => ['string','max:100','nullable'], "mimetypes"=> ['nullable'], "expire_date" => ['date_format:Y-m-d H:i:s','nullable'], ]; } protected function mimetypes(): Attribute { return Attribute::make( set: fn ($value) => json_encode($value), ); } public function getExts() { return implode(",", app()->collection->exts); } public function getMimeTypes() { return implode(",", app()->collection->mimetypes); } }