Roman_applicant-site/app/Models/Department.php

32 lines
642 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',
'slug',
'description',
'position',
];
public function faculty(): BelongsTo
{
return $this->belongsTo(Faculty::class);
}
public function directions(): HasMany
{
return $this->hasMany('App\Models\Direction', 'department_id');
}
}