*/ use HasFactory; protected $fillable = [ 'uuid', 'user_id', 'event_id', 'collection', 'name', 'mime_type', 'disk', 'path', 'thumbnail_path', 'preview_path', 'size', 'width', 'height', 'thumbnail_width', 'thumbnail_height', 'preview_width', 'preview_height', ]; protected function casts(): array { return [ 'size' => 'integer', 'width' => 'integer', 'height' => 'integer', 'thumbnail_width' => 'integer', 'thumbnail_height' => 'integer', 'preview_width' => 'integer', 'preview_height' => 'integer', ]; } protected static function booted(): void { static::creating(function (EventMedia $media): void { if (! $media->uuid) { $media->uuid = (string) Str::uuid(); } }); } public function event(): BelongsTo { return $this->belongsTo(Event::class); } public function user(): BelongsTo { return $this->belongsTo(User::class); } }