21 lines
417 B
PHP
21 lines
417 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
|
|
||
|
|
class Position extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = ['name'];
|
||
|
|
|
||
|
|
public function users()
|
||
|
|
{
|
||
|
|
return $this->hasMany(User::class, 'position_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function departments()
|
||
|
|
{
|
||
|
|
return $this->belongsToMany(Department::class, 'department_position');
|
||
|
|
}
|
||
|
|
}
|