*/ protected $fillable = [ 'title', 'description', 'type', 'difficulty', 'category_id', 'author_id', 'variants', 'is_pending_question', 'correct_answers', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'is_pending_question' => 'boolean', 'correct_answers' => 'array', 'variants' => 'array', ]; /** * Category relation (nullable, on delete set null). */ public function category() { return $this->belongsTo(Category::class); } /** * Author relation (nullable, on delete set null). */ public function author() { return $this->belongsTo(User::class, 'author_id'); } }