Initial
This commit is contained in:
31
app/Models/Comic.php
Normal file
31
app/Models/Comic.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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 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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user