Exemple #1
0
<?php

use LaravelPackages\Loaderio\Loaderio;
$apps = Loaderio::getApps();
Route::get('loaderio-{app_id}', function ($app_id) {
    // Check is this is a valid app_id
    if (Loaderio::isValidApp($app_id)) {
        // Create our own Http Repsonse and exit so that now other
        // packages can add additional data to the response
        // tool like loic-sharma/profiler screw with the response
        $response = new Illuminate\Http\Response(Request::path());
        $response->send();
        exit;
    }
});
 /**
  * Check if an APP ID is linked to this account
  * @param  string  $app_id Loader.io app_id
  * @return boolean
  */
 public static function isValidApp($app_id)
 {
     $app = Loaderio::api('apps/' . $app_id);
     return $app && $app->app_id == $app_id;
 }