<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Solution extends Model
{
    protected $fillable = [
        'name',
        'is_sub_solution',
        'solution_id'
    ];

    public function child() {
        return $this->hasMany(Solution::class, 'solution_id');
    }

    public function parent() {
        return $this->belongsTo(Solution::class, 'solution_id');
    }

    protected $casts = [
        'is_sub_solution' => 'boolean',
    ];
}
