47 lines
951 B
PHP
47 lines
951 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class EmploymentAssignment extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected $casts = [
|
|
'meta' => 'array',
|
|
'is_active' => 'boolean',
|
|
'is_primary' => 'boolean',
|
|
'start_date' => 'date',
|
|
'end_date' => 'date',
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function entity()
|
|
{
|
|
return $this->belongsTo(HoldingEntity::class, 'entity_id');
|
|
}
|
|
|
|
public function orgUnit()
|
|
{
|
|
return $this->belongsTo(OrgUnit::class, 'org_unit_id');
|
|
}
|
|
|
|
public function role()
|
|
{
|
|
return $this->belongsTo(\Spatie\Permission\Models\Role::class, 'role_id');
|
|
}
|
|
|
|
public function scopes()
|
|
{
|
|
return $this->hasMany(AssignmentPermissionScope::class, 'assignment_id');
|
|
}
|
|
}
|