You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
423 B
27 lines
423 B
<?php
|
|
namespace App\Http\Model;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class UserRole extends Model
|
|
{
|
|
//用户角色
|
|
|
|
protected $table = 'user_role';
|
|
public $timestamps = false;
|
|
|
|
/**
|
|
* 不能被批量赋值的属性
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $guarded = [];
|
|
|
|
/**
|
|
* 获取角色对应的用户
|
|
*/
|
|
public function user()
|
|
{
|
|
return $this->hasMany(User::class, 'role_id', 'id');
|
|
}
|
|
}
|