<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
chrisjohnleah / velocity-fleet-api-laravel example snippets
use ChrisJohnLeah\VelocityFleet\Laravel\Facades\VelocityFleet;
foreach (VelocityFleet::customers()->list() as $customer) {
// Use $customer->id (the unique id) for device positions — not $customer->number.
$positions = VelocityFleet::devicePositions()->forCustomer($customer->id);
foreach ($positions->devices as $device) {
info("{$device->vehicleRegistration} @ {$device->lat},{$device->lon} — ignition ".
($device->ignitionOn() ? 'on' : 'off'));
}
}
use ChrisJohnLeah\VelocityFleet\VelocityFleet;
public function index(VelocityFleet $velocity)
{
return $velocity->customers()->list();
}
use ChrisJohnLeah\VelocityFleet\Laravel\Facades\VelocityFleet;
$nearby = VelocityFleet::fleet($customer->id)
->moving()
->inDriverGroup(7)
->near($lat, $lon, 5.0); // within 5 km
use ChrisJohnLeah\VelocityFleet\Laravel\Testing\InteractsWithVelocityFleet;
use ChrisJohnLeah\VelocityFleet\Laravel\Testing\FakeDevice;
// fakeFleet([...]) / FakeDevice::make([...]) / FakeDevicePositions::withDevices([...]) / FleetScenario