34 lines
605 B
PHP
34 lines
605 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class UserDepartment extends Model
|
|
{
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
'rf_user_id',
|
|
'rf_department_id',
|
|
'is_favorite',
|
|
'order',
|
|
'user_name'
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_favorite' => 'boolean',
|
|
'order' => 'integer',
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'rf_user_id');
|
|
}
|
|
|
|
public function department()
|
|
{
|
|
return $this->belongsTo(Department::class, 'rf_department_id');
|
|
}
|
|
}
|