$http = new GuzzleHttp\Client;
$response = $http->post('http://your-app.com/oauth/token', [
'form_params' => [
'grant_type' => 'password',
'client_id' => 'client-id',
'client_secret' => 'client-secret',
'username' => 'taylor@laravel.com',
'password' => 'my-password',
'scope' => '',
],
]);
return json_decode((string) $response->getBody(), true);
Route::get('/user', function (Request $request) {
return $request->user();
})->middleware('auth:api');
$pdf = PDF::loadView('pdf.invoice', $data);
return $pdf->download('invoice.pdf');
$lat = (float) 55;
$lng = (float) 37;
$city = $lat.','$lng;
$nearest = \DB::table('localities')
->where('point', $city)
// join поправь под структуру таблицы.
->join('rating_results','localities.id','rating_results.local_id')
->select(\DB::raw("*,
(6371 * ACOS(COS(RADIANS($lat))
* COS(RADIANS(latitude))
* COS(RADIANS($lng) - RADIANS(longitude))
+ SIN(RADIANS($lat))
* SIN(RADIANS(latitude)))) AS distance")
)
->orderBy('distance', 'asc')->take(20)->get();
if($_SERVER['SERVER_NAME'] == 'subdomain.test.com') {
$this->layout = 'subdomain.layout';
}