Esempio n. 1
1
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
use App\Providers\RouteServiceProvider as Route;
/** @noinspection PhpUndefinedMethodInspection */
Route::get('/', function () {
    return view('welcome');
});
/** @noinspection PhpUndefinedMethodInspection */
Route::get('/phone', function () {
    $phone = app()->make('brandNewIphone6');
    /** @var \App\Lib\Rtyshyk\Smartphone $phone */
    return view('phone', ["phoneName" => $phone->getVendor()->getName() . " " . $phone->getName(), "cpu" => $phone->getCpu()->getName(), "cores" => $phone->getCpu()->getNumOfCores(), "display" => $phone->getDisplay()->getResolutionWidth() . "X" . $phone->getDisplay()->getResolutionHeight(), "camera" => $phone->getCamera()->getMegapixels(), "battery" => $phone->getBattery()->getCapacity()]);
});
/** @noinspection PhpUndefinedMethodInspection */
Route::get('/shorten', function () {
    $bitly = app()->make('BitlyAPI');
    /** @var \Hpatoio\Bitly\Client $bitly */
    /** @noinspection PhpUndefinedMethodInspection */
    $response = $bitly->Shorten(['longUrl' => 'http://academy.binary-studio.com/']);
    return $response['url'];
});