57 lines
1.2 KiB
PHP
57 lines
1.2 KiB
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\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Direction extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'id',
|
|
'name',
|
|
'full_name',
|
|
'description',
|
|
'position',
|
|
'slug',
|
|
'code',
|
|
'budget_places',
|
|
'quota',
|
|
'paid_places',
|
|
'cost_paid_place',
|
|
'period',
|
|
];
|
|
|
|
public function department(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Department::class);
|
|
}
|
|
|
|
public function educationLevel(): BelongsTo
|
|
{
|
|
return $this->belongsTo(EducationLevel::class);
|
|
}
|
|
|
|
public function educationForm(): BelongsTo
|
|
{
|
|
return $this->belongsTo(EducationForm::class);
|
|
}
|
|
|
|
public function entranceExaminations(): HasMany
|
|
{
|
|
return $this->hasMany('App\Models\EntranceExamination', 'direction_id');
|
|
}
|
|
|
|
|
|
|
|
public function directionProfiles(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(DirectionProfile::class);
|
|
}
|
|
}
|