generated from Flycro/laravel-nuxt
36 lines
748 B
PHP
36 lines
748 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Events\Deadline\DeadlineCreated;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Deadline extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'book_recommendation_id',
|
|
'deadline',
|
|
'target_page',
|
|
'target_chapter',
|
|
];
|
|
|
|
protected static function booted() :void
|
|
{
|
|
static::created(static function ($deadline) {
|
|
event(new DeadlineCreated($deadline));
|
|
});
|
|
}
|
|
|
|
public function bookRecommendation()
|
|
{
|
|
return $this->belongsTo(BookRecommendation::class);
|
|
}
|
|
public function userDeadlines()
|
|
{
|
|
return $this->hasMany(UserDeadline::class);
|
|
}
|
|
}
|