44 lines
808 B
PHP
44 lines
808 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Comic extends Model
|
|
{
|
|
|
|
protected $fillable = [
|
|
'pathword',
|
|
'uuid',
|
|
'name',
|
|
'alias',
|
|
'description',
|
|
'cover',
|
|
'upstream_updated_at',
|
|
'metadata',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'uuid' => 'string',
|
|
'alias' => 'array',
|
|
'upstream_updated_at' => 'datetime:Y-m-d',
|
|
'metadata' => 'json',
|
|
];
|
|
}
|
|
|
|
public function authors(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Author::class);
|
|
}
|
|
|
|
public function chapters(): HasMany
|
|
{
|
|
return $this->hasMany(Chapter::class);
|
|
}
|
|
|
|
}
|