|
|
@ -3,6 +3,8 @@ |
|
|
namespace App\Http\Controllers\Admin; |
|
|
namespace App\Http\Controllers\Admin; |
|
|
|
|
|
|
|
|
use App\Http\Controllers\Controller; |
|
|
use App\Http\Controllers\Controller; |
|
|
|
|
|
use App\Models\ParkingLicensePlate; |
|
|
|
|
|
use App\Models\ParkingSpace; |
|
|
use App\Models\ParkingVipAccessRecord; |
|
|
use App\Models\ParkingVipAccessRecord; |
|
|
use App\Models\ParkingVipList; |
|
|
use App\Models\ParkingVipList; |
|
|
use App\Models\ParkingSpaceType; |
|
|
use App\Models\ParkingSpaceType; |
|
|
@ -36,31 +38,36 @@ class VipAccessRecordController extends Controller |
|
|
if ($request->has('space_type')) { |
|
|
if ($request->has('space_type')) { |
|
|
$space_type = $request->input('space_type'); |
|
|
$space_type = $request->input('space_type'); |
|
|
if (!empty($space_type)) { |
|
|
if (!empty($space_type)) { |
|
|
$space_type_ids = ParkingSpaceType::query()->where( |
|
|
$query->where('space_type_id', $space_type); |
|
|
'name', |
|
|
|
|
|
'like', |
|
|
|
|
|
"%{$space_type}%" |
|
|
|
|
|
)->pluck('id'); |
|
|
|
|
|
$query->whereIn('parking_space_id', $space_type_ids); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($request->exists('space_number')) { |
|
|
if ($request->exists('space_number')) { |
|
|
$space_number = $request->input('space_number'); |
|
|
$space_number = $request->input('space_number'); |
|
|
if (!empty($space_number)) { |
|
|
if (!empty($space_number)) { |
|
|
|
|
|
$space_id = ParkingSpace::getId($space_number); |
|
|
|
|
|
if ($space_id) { |
|
|
|
|
|
$query->where('space_id', $space_id); |
|
|
|
|
|
} else { |
|
|
|
|
|
$query->where('id', 0); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($request->has('license')) { |
|
|
if ($request->has('license')) { |
|
|
$license = $request->input('license'); |
|
|
$license = $request->input('license'); |
|
|
if (!empty($license)) { |
|
|
if (!empty($license)) { |
|
|
$vipIds = ParkingVipList::query()->where( |
|
|
$license_ids = ParkingLicensePlate::getId($license); |
|
|
'license', |
|
|
if ($license_ids) { |
|
|
'like', |
|
|
$vipIds = ParkingVipList::query()->whereIn( |
|
|
"%{$license}%" |
|
|
'license_id', |
|
|
)->pluck('id'); |
|
|
$license_ids |
|
|
if ($vipIds) { |
|
|
)->pluck('id'); |
|
|
$query->whereIn('vip_list_id', $vipIds); |
|
|
if ($vipIds) { |
|
|
|
|
|
$query->whereIn('vip_list_id', $vipIds); |
|
|
|
|
|
} else { |
|
|
|
|
|
$query->where('id', 0); |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
$query->where('id', 0); |
|
|
$query->where('id', 0); |
|
|
} |
|
|
} |
|
|
@ -125,20 +132,18 @@ class VipAccessRecordController extends Controller |
|
|
|
|
|
|
|
|
protected function optionItem($item) |
|
|
protected function optionItem($item) |
|
|
{ |
|
|
{ |
|
|
$item['license_number'] = ParkingVipList::query()->where( |
|
|
$license_id = ParkingVipList::query()->where( |
|
|
'id', |
|
|
'id', |
|
|
$item['vip_list_id'] |
|
|
$item['vip_list_id'] |
|
|
)->value('license'); |
|
|
)->value('license_id') ?? 0; |
|
|
$item['space_type'] = ParkingSpaceType::query()->where( |
|
|
$item['license_number'] = ParkingLicensePlate::getNumber($license_id) |
|
|
'id', |
|
|
?? ''; |
|
|
$item |
|
|
$item['space_number'] = ParkingSpace::getNumber($item['space_id']); |
|
|
['parking_space_id'] |
|
|
$item['space_type'] = ParkingSpaceType::getName($item['space_type_id']); |
|
|
)->value('name'); |
|
|
|
|
|
$item['space_number'] = ""; |
|
|
|
|
|
unset( |
|
|
unset( |
|
|
$item['vip_list_id'], |
|
|
$item['vip_list_id'], |
|
|
$item['parking_space_id'], |
|
|
$item['space_id'], |
|
|
$item['parking_number_id'] |
|
|
$item['space_type_id'] |
|
|
); |
|
|
); |
|
|
return $item; |
|
|
return $item; |
|
|
} |
|
|
} |
|
|
|