| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Services;
- use App\Models\DrugReportInfo;
- use Illuminate\Support\Arr;
- use Illuminate\Support\Facades\DB;
- class DrugReportInfoService
- {
- public function getList(array $filters, string $search, array $sort, int $perPage) {
- $options = array_merge([
- 'search' => $search,
- 'searchable' => DrugReportInfo::$searchable,
- ], $sort);
- $query = DrugReportInfo::query()
- ->applyFilters(
- $filters,
- $options,
- );
- return $query->paginate($perPage);
- }
- /**
- * 获取生产企业选项
- * @return array
- */
- public function getProduceEntIdOption(): array
- {
- return DrugReportInfo::query()
- ->where('produce_ent_id', '!=', '')
- ->pluck('produce_ent_name', 'produce_ent_id')
- ->unique()
- ->toArray();
- }
- /**
- * 获取发货企业选项
- * @return array
- */
- public function getFromRefEntIdOption(): array
- {
- return DrugReportInfo::query()
- ->where('from_ref_ent_id', '!=', '')
- ->pluck('from_ent_name', 'from_ref_ent_id')
- ->unique()
- ->toArray();
- }
- }
|