Files
SkinbaseNova/app/Models/Upload.php
T
klevze 6b00652a20 Allow artworks to have one primary category and extra secondaries.
Keep artwork_category as membership, store a deterministic primary_category_id, and let upload plus studio pick up to five additional same-type categories without changing canonical URLs.
2026-09-20 14:50:12 +02:00

65 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Upload extends Model
{
protected $table = 'uploads';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'id',
'user_id',
'type',
'status',
'processing_state',
'title',
'slug',
'category_id',
'secondary_category_ids',
'description',
'tags',
'license',
'nsfw',
'is_scanned',
'has_tags',
'preview_path',
'published_at',
'final_path',
'expires_at',
'moderation_status',
'moderated_at',
'moderated_by',
'moderation_note',
];
protected $casts = [
'tags' => 'array',
'secondary_category_ids' => 'array',
'nsfw' => 'boolean',
'is_scanned' => 'boolean',
'has_tags' => 'boolean',
'published_at' => 'datetime',
'expires_at' => 'datetime',
'moderated_at' => 'datetime',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function category(): BelongsTo
{
return $this->belongsTo(Category::class);
}
}