CarTypeService.php 495 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace App\Services;
  3. use App\CarType;
  4. use App\Traits\ServiceAppAop;
  5. class CarTypeService
  6. {
  7. use ServiceAppAop;
  8. protected $modelClass=CarType::class;
  9. /*
  10. * array | string $column
  11. * 默认一些select字段,可传递string 或 array来指定select字段
  12. */
  13. public function getSelection($column = ['id','name']){
  14. if (!is_array($column)) {
  15. $column = [$column];
  16. }
  17. return CarType::query()->select($column)->get();
  18. }
  19. }