Files
compras/app/Services/SupplierGeography.php
nala 63d20b10fc
tests / ci (push) Canceled after 0s
commit de armazens
2026-11-04 09:40:26 +02:00

23 lines
734 B
PHP

<?php
namespace App\Services;
use App\Models\Supplier;
use Illuminate\Database\Eloquent\Builder;
class SupplierGeography
{
/** Current supplier registration only; never infer geography from address text or evaluation snapshots.
* @return Builder<Supplier>
*/
public function matching(string $location): Builder
{
$geography = app(AdministrativeGeography::class);
abort_unless($geography->enabled(), 503);
return Supplier::query()->where('geography_reference->country', 'MZ')
->where('geography_reference->catalogue', $geography->catalogue()['manifest']['source_sha256'])
->whereIn('geography_reference->record_id', $geography->descendants($location));
}
}