37 lines
601 B
PHP
37 lines
601 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Image extends Model
|
|
{
|
|
|
|
protected $fillable = [
|
|
'comic_id',
|
|
'chapter_id',
|
|
'order',
|
|
'url',
|
|
'metadata',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'metadata' => 'json',
|
|
];
|
|
}
|
|
|
|
public function chapter(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Chapter::class);
|
|
}
|
|
|
|
public function comic(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Comic::class);
|
|
}
|
|
|
|
}
|