34 lines
1.0 KiB
PHP
34 lines
1.0 KiB
PHP
<?php
|
|
require 'vendor/autoload.php';
|
|
$app = require_once 'bootstrap/app.php';
|
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
|
$status = $kernel->handle(
|
|
$input = new Symfony\Component\Console\Input\ArgvInput,
|
|
new Symfony\Component\Console\Output\ConsoleOutput
|
|
);
|
|
|
|
use App\Models\Service;
|
|
use App\Models\ProviderServiceAddressMapping;
|
|
|
|
$query = Service::where('status', 1)->where('service_type', 'service')->where('is_available', 'yes');
|
|
$query->whereIn('provider_id', [1012]);
|
|
|
|
$lat = 14.6633062;
|
|
$lng = 121.0406245;
|
|
$radius = 20;
|
|
$unit = 'km';
|
|
|
|
$locations = Service::locationService($lat, $lng, $radius, $unit);
|
|
$svc_ids = ProviderServiceAddressMapping::whereIn('provider_address_id', $locations)->pluck('service_id');
|
|
|
|
$query->where(function($q) use ($svc_ids) {
|
|
$q->whereIn('id', $svc_ids)->orWhere('visit_type', 'online');
|
|
});
|
|
|
|
print_r([
|
|
'SQL' => $query->toSql(),
|
|
'Bindings' => $query->getBindings(),
|
|
'Count' => $query->count(),
|
|
'Services' => $query->pluck('id')->toArray(),
|
|
]);
|