Exemplo n.º 1
0
 public function getPosition($placa)
 {
     $vehicle = Vehicle::where('plate', $placa)->first();
     $position = $vehicle->Positions()->orderBy('memory_index', 'desc')->first();
     $retorno = array('latitude' => $position->latitude, 'longitude' => $position->longitude, 'speed' => $position->speed, 'ignition' => $position->ignition);
     echo json_encode($retorno);
 }
Exemplo n.º 2
0
 public function getAutocomplete()
 {
     return Vehicle::where("plate", "like", strtoupper(\Input::get("q")) . "%")->whereHas('Account', function ($query) {
         $query->where('company_id', Auth::user()->company_id);
     })->take(10)->select(\DB::raw('plate, id'))->get();
 }