Example #1
0
[![Forms](../resources/Form.gif)](users.html)
We have made it easy to try different styles
Also this example serves as an example for our Blade template integration

See bootstrap3.blade.php and foundation5.blade.php

Content:

*[bootstrap3.blade.php]: _016_forms/views/base/bootstrap3.blade.php
*[foundation5.blade.php]: _016_forms/views/base/foundation5.blade.php
*/
$loader = (include '../../../vendor/autoload.php');
$loader->setUseIncludePath(true);
use Luracast\Restler\Data\Validator;
use Luracast\Restler\Restler;
use Luracast\Restler\Defaults;
use Luracast\Restler\Format\HtmlFormat;
use Luracast\Restler\UI\Forms;
use Luracast\Restler\UI\FormStyles;
HtmlFormat::$viewPath = __DIR__ . '/views';
HtmlFormat::$template = 'blade';
Validator::$holdException = true;
$themes = array('amelia', 'cerulean', 'cosmo', 'cyborg', 'darkly', 'flatly', 'journal', 'lumen', 'readable', 'simplex', 'slate', 'spacelab', 'superhero', 'united', 'yeti');
$theme = isset($_GET['theme']) ? $_GET['theme'] : $themes[array_rand($themes, 1)];
$style = $theme == 'foundation5' ? 'foundation5' : 'bootstrap3';
HtmlFormat::$data += compact('theme', 'themes', 'style');
Forms::$style = FormStyles::${$style};
$r = new Restler();
$r->setSupportedFormats('HtmlFormat');
$r->addAPIClass('Users');
$r->handle();
    }
    return false;
}, true, true);
/*
|--------------------------------------------------------------------------
| Bind Paths
|--------------------------------------------------------------------------
|
| Here we are binding the paths configured in paths.php to the app. You
| should not be changing these here. If you need to change these you
| may do so within the paths.php file and they will be bound here.
|
*/
$app->bindInstallPaths(require __DIR__ . '/paths.php');
/*
|--------------------------------------------------------------------------
| Configure Restler to adapt to Laravel  4.2 structure
|--------------------------------------------------------------------------
*/
use Luracast\Restler\Defaults;
use Luracast\Restler\Format\HtmlFormat;
use Luracast\Restler\UI\Forms;
use Luracast\Restler\UI\FormStyles;
use Luracast\Restler\Scope;
$app['config']['app.aliases'] += Scope::$classAliases + ['Scope' => 'Luracast\\Restler\\Scope'];
HtmlFormat::$viewPath = $app['path'] . '/views';
HtmlFormat::$cacheDirectory = $app['path.storage'] . '/views';
Defaults::$cacheDirectory = $app['path.storage'] . '/cache';
HtmlFormat::$template = 'blade';
Forms::$style = FormStyles::$bootstrap3;