| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace App\Services;
- use App\OwnerReport;
- use App\Services\common\QueryService;
- use Illuminate\Database\Eloquent\Builder;
- Class OwnerReportService
- {
- /**
- * @param Builder $builder
- * @param array $params
- * @return Builder
- */
- private function query(Builder $builder, array $params)
- {
- $columnQueryRules = [
- 'counting_month_start' => ['alias' => 'counting_month', 'startDate' => '-01'],
- 'counting_month_end' => ['alias' => 'counting_month', 'endDate' => '-31'],
- 'owner_id' => ['multi' => ','],
- ];
- return app(QueryService::class)->query($params, $builder, $columnQueryRules,"owner_reports");
- }
- public function get(array $params, array $withs = null)
- {
- $query = OwnerReport::query();
- if ($withs)$query->with($withs);
- return $this->query($query,$params)->get();
- }
- public function paginate(array $params, array $withs = null)
- {
- $query = OwnerReport::query();
- if ($withs)$query->with($withs);
- return $this->query($query,$params)->paginate($params["paginate"] ?? 50);
- }
- }
|