Roman_applicant-site/app/Models/Direction.php

57 lines
1.2 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-29 18:00:50 +03:00
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
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',
'full_name',
2024-02-10 11:23:38 +03:00
'description',
'position',
2024-02-14 16:16:44 +03:00
'slug',
'code',
2024-03-14 16:12:44 +03:00
'budget_places',
'quota',
'paid_places',
'cost_paid_place',
'period',
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
2024-02-26 09:37:27 +03:00
2024-02-26 14:20:16 +03:00
2024-02-29 18:00:50 +03:00
public function directionProfiles(): BelongsToMany
2024-02-26 14:20:16 +03:00
{
2024-02-29 18:00:50 +03:00
return $this->belongsToMany(DirectionProfile::class);
2024-02-26 14:20:16 +03:00
}
2024-02-10 11:23:38 +03:00
}