mirror of
https://github.com/HtetPhone/MangaDex.git
synced 2025-02-20 11:23:19 +08:00
30 lines
617 B
PHP
30 lines
617 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Chapter extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = ['title', 'images', 'manga_id', 'user_id', 'chapter_no'];
|
|
protected $casts = [
|
|
'images' => 'array'
|
|
];
|
|
|
|
public function manga()
|
|
{
|
|
return $this->belongsTo(Manga::class, 'manga_id');
|
|
}
|
|
|
|
public function comments() {
|
|
return $this->hasMany(Comment::class, 'chapter_id');
|
|
}
|
|
|
|
public function user() {
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
}
|