123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Filters\Traits;
- use App\Models\Order;
- use App\Models\OrderRent;
- use Illuminate\Database\Eloquent\Builder;
- trait OrderOperateBikeFilter
- {
- public function operateStatus($val)
- {
- $this->builder->whereHas('order_bike_operates', function (Builder $query) use ($val) {
- $query->where('type', $val);
- });
- }
- public function putAreaId($val)
- {
- $this->builder->where('area_id', $val);
- }
- public function normalRiding($val)
- {
- if ($val == 1) {
- $this->builder->where(function ($q) {
- $q->where('status', Order::STATUS_RIDE_BIKE)->orWhere('status', Order::STATUS_PAUSE_BIKE);
- });
- }
- }
- public function rentRiding($val)
- {
- if ($val == 1) {
- $this->builder->where(function ($q) {
- $q->where('status', OrderRent::STATUS_RENT_BIKE);
- });
- }
- }
- public function isDispatchMoney($val)
- {
- if ($val == 1) {
- $this->builder->where('dispatch_money', '>', 0);
- } elseif ($val == 2) {
- $this->builder->where('dispatch_money', '=', 0);
- }
- }
- }
|