45 lines
806 B
PHP
45 lines
806 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||
|
|
|
||
|
|
class UserRole extends Model
|
||
|
|
{
|
||
|
|
use SoftDeletes;
|
||
|
|
|
||
|
|
protected $table = 'user_roles';
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'user_id',
|
||
|
|
'tenant_id',
|
||
|
|
'role_id',
|
||
|
|
'assigned_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'user_id' => 'integer',
|
||
|
|
'tenant_id' => 'integer',
|
||
|
|
'role_id' => 'integer',
|
||
|
|
'assigned_at' => 'datetime',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 사용자
|
||
|
|
*/
|
||
|
|
public function user(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(User::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 역할
|
||
|
|
*/
|
||
|
|
public function role(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Role::class);
|
||
|
|
}
|
||
|
|
}
|