OrganModel.php 888 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace app\models\course;
  3. use crmeb\traits\ModelTrait;
  4. use crmeb\basic\BaseModel;
  5. class OrganModel extends BaseModel
  6. {
  7. /**
  8. * 数据表主键
  9. * @var string
  10. */
  11. protected $pk = 'id';
  12. /**
  13. * 模型名称
  14. * @var string
  15. */
  16. protected $name = 'organ';
  17. use ModelTrait;
  18. public static function systemPage($where)
  19. {
  20. $model = new self;
  21. $model = $model->where('is_del', 0);
  22. $count = $model->count();
  23. $list = $model->page((int)$where['page'], (int)$where['limit'])->select()->each(function ($item) {
  24. $item['_add_time'] = date('Y-m-d H:i:s', $item['add_time']);
  25. })->toArray();
  26. return compact('count', 'list');
  27. }
  28. /**
  29. * 详情
  30. */
  31. public static function getOne($id)
  32. {
  33. $info = self::where('is_del', 0)->find($id);
  34. return $info;
  35. }
  36. }