applicant-site/app/Models/Direction.php

53 lines
1.1 KiB
PHP
Raw Normal View History

2024-02-10 11:23:38 +03:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
2024-02-19 10:51:20 +03:00
use Illuminate\Database\Eloquent\Relations\HasMany;
2024-02-10 11:23:38 +03:00
class Direction extends Model
{
use HasFactory;
protected $fillable = [
'id',
'name',
'description',
'position',
2024-02-14 16:16:44 +03:00
'slug',
'code',
2024-02-10 11:23:38 +03:00
];
public function department(): BelongsTo
{
return $this->belongsTo(Department::class);
}
2024-02-14 16:16:44 +03:00
public function educationLevel(): BelongsTo
{
return $this->belongsTo(EducationLevel::class);
}
2024-02-15 09:58:01 +03:00
public function educationForm(): BelongsTo
{
return $this->belongsTo(EducationForm::class);
}
2024-02-19 10:51:20 +03:00
public function entranceExaminations(): HasMany
{
return $this->hasMany('App\Models\EntranceExamination', 'direction_id');
}
2024-02-19 18:55:44 +03:00
public function places(): HasMany
{
return $this->hasMany('App\Models\Place', 'direction_id');
}
2024-02-26 09:37:27 +03:00
public function costs(): HasMany
{
return $this->hasMany('App\Models\Cost', 'direction_id');
}
2024-02-10 11:23:38 +03:00
}