49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/**
|
|
* Precomputed recommendation list for an artwork.
|
|
*
|
|
* @property int $id
|
|
* @property int $artwork_id
|
|
* @property string $rec_type similar_hybrid|similar_visual|similar_tags|similar_behavior
|
|
* @property array $recs Ordered array of artwork IDs
|
|
* @property string $model_version e.g. "sim_v1"
|
|
* @property \Carbon\Carbon $computed_at
|
|
* @property \Carbon\Carbon $created_at
|
|
* @property \Carbon\Carbon $updated_at
|
|
*
|
|
* @property-read Artwork $artwork
|
|
*/
|
|
final class RecArtworkRec extends Model
|
|
{
|
|
protected $table = 'rec_artwork_recs';
|
|
|
|
protected $fillable = [
|
|
'artwork_id',
|
|
'rec_type',
|
|
'recs',
|
|
'model_version',
|
|
'computed_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'artwork_id' => 'integer',
|
|
'recs' => 'array',
|
|
'computed_at' => 'datetime',
|
|
];
|
|
|
|
// ── Relations ──────────────────────────────────────────────────────────
|
|
|
|
public function artwork(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Artwork::class, 'artwork_id');
|
|
}
|
|
}
|