42 lines
1013 B
PHP
42 lines
1013 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\ProjectFileRenderFactory;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ProjectFileRender extends Model
|
|
{
|
|
/** @use HasFactory<ProjectFileRenderFactory> */
|
|
use HasFactory;
|
|
|
|
public const RENDERER_GD = 'gd';
|
|
|
|
public const RENDERER_SVG = 'svg';
|
|
|
|
protected $fillable = [
|
|
'project_file_id', 'renderer', 'mime_type', 'storage_key', 'width', 'height',
|
|
'triangle_count', 'instance_count', 'alt_text', 'byte_size', 'sha256',
|
|
'generated_by', 'generated_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'generated_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function projectFile(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ProjectFile::class);
|
|
}
|
|
|
|
public function generator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'generated_by');
|
|
}
|
|
}
|