Files
ntspi-app/app/Models/Faculty.php
T
2024-09-19 16:06:49 +05:00

31 lines
537 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Faculty extends Model
{
use HasFactory;
protected $guarded = false;
protected $casts = [
'content' => 'array',
];
public function departments()
{
return $this->hasMany(Department::class);
}
public function workers()
{
return $this->belongsToMany(User::class, 'workers_faculties')->withPivot(['position'])->whereHas('userDetail');
}
}