示例#1
0
function drawOneAircraftForm($index, $aircraft, $template = false)
{
    // $index       integer     The array index to use when submitting this form
    // $aircraft    Aircraft    An Aircraft model to populate this form with - ['tailnumber'=>'N12345', 'model'=>'Bell 205']
    // $template    boolean     If TRUE, this function will draw the blank template for an Aircraft Form rather than a populated form.
    if ($template) {
        $aircraft = new App\Aircraft(array("tailnumber" => "", "model" => ""));
        $index = "";
    }
    $output = "<div class=\"crew-aircraft-form";
    if ($template) {
        $output .= " dynamic-form-template";
    }
    $output .= "\">\n        <div class=\"form-group\">\n            <label for=\"aircraft-tailnumber\" class=\"control-label col-sm-2\">Tailnumber</label>\n            <div class=\"col-sm-4 col-md-3\">\n                <input type=\"text\" class=\"form-control aircraft-tailnumber\" name=\"crew[aircrafts][" . $index . "][tailnumber]\" value=\"" . $aircraft->tailnumber . "\" ";
    if (!$template) {
        $output .= "readonly ";
    }
    $output .= "/>\n            </div>\n";
    if (!$template) {
        $output .= "<button class=\"btn btn-default release-aircraft-button\" data-aircraft-id=\"" . $index . "\" type=\"button\">Release</button>\n";
    }
    $output .= "\n        </div>\n\n        <div class=\"form-group\">\n            <label for=\"aircraft-model\" class=\"control-label col-sm-2\">Make/Model</label>\n            <div class=\"col-sm-4 col-md-3\">\n                <input type=\"text\" class=\"form-control aircraft-model\" name=\"crew[aircrafts][" . $index . "][model]\" value=\"" . $aircraft->model . "\" />\n            </div>\n        </div>\n";
    if (!$template) {
        $output .= "<div class=\"form-group\">\n                        <div class=\"col-sm-offset-2\">\n                            <a href=\"" . route('new_status_for_aircraft', $aircraft->tailnumber) . "\" class=\"btn btn-default\" role=\"button\">Go to the Status Page</a>\n                        </div>\n                    </div>\n";
        $output .= freshnessNotify($aircraft->freshness());
    } else {
        $output .= "<div class=\"alert alert-warning\"><strong>Remember:</strong> this new aircraft won't show up on the map until you submit a Status Update!</div>";
    }
    $output .= "</div>\n";
    echo $output;
}
示例#2
0
| 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.
|
*/
Route::bind('airports', function ($slug) {
    return App\Airport::whereSlug($slug)->first();
});
Route::bind('airlines', function ($slug) {
    return App\Airline::whereSlug($slug)->first();
});
Route::bind('aircraft', function ($slug) {
    return App\Aircraft::whereSlug($slug)->first();
});
// Authentication routes...
Route::get('auth/login', 'Auth\\AuthController@getLogin');
Route::post('auth/login', 'Auth\\AuthController@postLogin');
Route::get('auth/logout', 'Auth\\AuthController@getLogout');
// Registration routes...
Route::get('auth/register', 'Auth\\AuthController@getRegister');
Route::post('auth/register', 'Auth\\AuthController@postRegister');
// Basic routes...
Route::get('/', 'WelcomeController@index');
Route::get('/home', 'WelcomeController@index');
Route::get('/pilots', 'PilotController@index');
// Category Specific
Route::resource('airlines', 'AirlinesController', ['names' => ['index' => 'airlines_path', 'show' => 'airline_path', 'showimg' => 'airline_path', 'edit' => 'airline_path', 'store' => 'airline_path', 'update' => 'airline_path', 'destroy' => 'airline_path', 'create' => 'airline_path']]);
Route::resource('airports', 'AirportsController', ['names' => ['index' => 'airports_path', 'show' => 'airport_path', 'showimg' => 'airport_path', 'edit' => 'airport_path', 'store' => 'airport_path', 'update' => 'airport_path', 'destroy' => 'airport_path', 'create' => 'airport_path']]);