applicant-site/app/Models/Department.php

31 lines
626 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Department extends Model
{
use HasFactory;
protected $fillable = [
'id',
'name',
'description',
'position',
];
public function faculty(): BelongsTo
{
return $this->belongsTo(Faculty::class);
}
public function directions(): HasMany
{
return $this->hasMany('App\Models\Direction', 'department_id');
}
}