AlbumUserModel.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Notifications\Notifiable;
  4. use Laravel\Passport\HasApiTokens;
  5. use Illuminate\Foundation\Auth\User as Authenticatable;
  6. use Illuminate\Database\Eloquent\SoftDeletes;
  7. /**
  8. * @description 用户管理
  9. * @author system;
  10. * @version 1.0
  11. * @date 2018-05-14 13:25:12
  12. *
  13. */
  14. class AlbumUserModel extends Authenticatable
  15. {
  16. use HasApiTokens, Notifiable, SoftDeletes;
  17. /**
  18. * 数据表名
  19. *
  20. * @var string
  21. *
  22. */
  23. protected $table = 'album_user';
  24. /**
  25. * 主键
  26. */
  27. protected $primaryKey = 'id';
  28. //分页
  29. protected $perPage = PAGE_NUMS;
  30. /**
  31. * 可以被集体附值的表的字段
  32. *
  33. * @var string
  34. */
  35. protected $fillable = [
  36. 'username',
  37. 'wechat_open_id',
  38. 'address',
  39. 'lng',
  40. 'lat',
  41. 'g_open_id',
  42. 'open_id',
  43. 'wechat_union_id',
  44. 'avatar',
  45. 'store_id',
  46. 'is_dealer',
  47. 'is_boss',
  48. 'phone',
  49. 'role'
  50. ];
  51. public function role(){
  52. switch ($this->role){
  53. case 1:
  54. return '生产部';
  55. break;
  56. case 2:
  57. return '包装部';
  58. break;
  59. case 3:
  60. return '经理';
  61. break;
  62. case 4:
  63. return 'Boss';
  64. break;
  65. default:
  66. return '普通用户';
  67. break;
  68. }
  69. }
  70. }