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.

25 lines
405 B

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