You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
924 B

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\SoftDeletes;
class ResearchDirection extends Model
{
use SoftDeletes;
protected $fillable = [
'name',
'sort',
'status',
'remark',
];
protected $casts = [
'sort' => 'integer',
'status' => 'integer',
];
public function adminUsers(): BelongsToMany
{
return $this->belongsToMany(
AdminUser::class,
'admin_user_research_directions',
'research_direction_id',
'admin_user_id'
);
}
public function teachers(): BelongsToMany
{
return $this->belongsToMany(
Teacher::class,
'teacher_research_direction',
'research_direction_id',
'teacher_id'
);
}
}