You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.3 KiB
62 lines
1.3 KiB
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Collection extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
|
|
protected $fillable = [
|
|
"name",
|
|
"path",
|
|
"public",
|
|
"disk",
|
|
"count",
|
|
"tmp_support",
|
|
"remove_tmp_time",
|
|
"max_file_size",
|
|
"min_file_size",
|
|
"max_width",
|
|
"min_width",
|
|
"max_height",
|
|
"min_height",
|
|
"alt_required",
|
|
"description_required",
|
|
"exts",
|
|
"avalible_exts",
|
|
"memetypes",
|
|
"model",
|
|
"expire_date",
|
|
];
|
|
|
|
protected $casts = [
|
|
'exts' => 'array',
|
|
'avalible_exts' => 'array',
|
|
'memetypes' => 'array',
|
|
];
|
|
|
|
protected function exts(): Attribute
|
|
{
|
|
return Attribute::make(
|
|
set: fn ($value) => json_encode($value),
|
|
);
|
|
}
|
|
protected function avalible_exts(): Attribute
|
|
{
|
|
return Attribute::make(
|
|
set: fn ($value) => json_encode($value),
|
|
);
|
|
}
|
|
protected function memetypes(): Attribute
|
|
{
|
|
return Attribute::make(
|
|
set: fn ($value) => json_encode($value),
|
|
);
|
|
}
|
|
|
|
}
|