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

7 years ago
7 years ago
7 years ago
  1. <?php
  2. namespace App\Http\Model;
  3. use Illuminate\Database\Eloquent\Model;
  4. class UserRole extends Model
  5. {
  6. //用户角色
  7. protected $table = 'user_role';
  8. public $timestamps = false;
  9. /**
  10. * 不能被批量赋值的属性
  11. *
  12. * @var array
  13. */
  14. protected $guarded = [];
  15. /**
  16. * 获取角色对应的用户
  17. */
  18. public function user()
  19. {
  20. return $this->hasMany(User::class, 'role_id', 'id');
  21. }
  22. }