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.
|
|
<?php
namespace App\Models;
use App\Models\Traits\Validatable; use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Str;
class File extends Model { use HasFactory, SoftDeletes;
protected $primaryKey = 'uuid';
protected $fillable = [ "uuid", "original_name", "ext", "memetype", "width", "server_path", "height", "file_size", "sort", "alts", "description", "user_id", "ip", "collection_id", "published_at", ];
protected $casts = [ 'alts' => 'array', ];
protected function uuid(): Attribute { return Attribute::make( set: fn ($value) => Str::uuid(), ); }
protected function alts(): Attribute { return Attribute::make( set: fn ($value) => json_encode($value), ); }
}
|