A Laravel model-based CMS
By Bukwild
The following additional fields come with Decoy. They are implemented through Former so you can chain any of the standard Former method calls onto them like “blockhelp”, etc.

route($route) or parent($model) to provide the route that can be AJAX GET requested to serve data to the autocomplete.->value(2)->title("Example").echo Former::belongsTo('related_product_id', 'Related product')->route('/admin/products');
echo Former::belongsTo('related_product_id', 'Related product')->parent(App\Project::class);
echo Former::belongsTo('author_id', 'Author')->route('/admin/admins')->value(app('decoy.user')->id)->title(app('decoy.user')->getAdminTitleAttribute());
echo Former::boolean('featured')->message('Yes, featured')
checkbox field so that it’s easier to instantiate using a simple associative arrayecho Former::checklist('category')->from([
'car' => 'Red Car',
'bus' => 'Big bus'
]);
// In your model
protected $casts = [
'category' => 'array',
];

'now', the current date will populate the field``echo Former::date('date', 'Start date')->value('now');
date() and time() elements.->date($attributes) and ->time($attributes) where $attributes is an associative array.Field instances for each field, access the public properties $date and $time.echo Former::datetime('when')->date(array('data-example', 'Hey'))->value('now');

aspect(number)addFocalPoint()echo Former::image('image', 'Profile image')->aspect(16/9)->addFocalPoint();

name for the field should be the model class that is being rendered. Like Article.controller() specifies the controller name if it can’t be automatically determined. You may also pass it an instance of a controller class.items() stores a collection of model instances to display in the list. This is optional, listing() will try and make a query using the model name to form a query.layout() allows you to specify the layout. This is automatically set when passing a Listing instance to $sidebar->add() from a view.
full - A full width view like shown on Decoy’s index view.sidebar - A narrow view like shown in an edit view’s related column.form - A full width view designed to be show in a horizontal form.take() - A integer; how many rows to display.scope() - You may adjust the query that fetches related objects by passing a callable to scope() which will recieve the query (an Illuminate\Database\Eloquent\Builder instance) as it’s first argument.echo Former::listing('Author')->take(30)->layout('form');

type is a checkbox.name. This is the name of the relationship method that is defined on the model that is currently being edited in Decoy.callable to scope() which will recieve the query (an Illuminate\Database\Eloquent\Builder instance) as it’s first argument.addGroupClass('two-col')decorator($callable) to pass a function that recieves each checkboxes HTML and model instance and expects you to return transformed HTML for the checkbox.echo Former::manyToManyChecklist('hubs')
->scope(function($query) use ($product) {
return $query->where('product_id', '=', $product->id);
})->decorator(function($html, $model) {
return $html.Form::hidden('key', 'val');
});
echo Former::note('Creator', $author->name);
radio field so that it’s easier to instantiate using a simple associative arrayecho Former::radiolist('category')->from([
'car' => 'Red Car',
'bus' => 'Big bus'
]);
'now', the current date will populate the field.echo Former::time('time')->value('now');
upload_attributes property. See the usage section of the Upchuck README for examples.echo Former::upload('file');

upload_attributes property. See the usage section of the Upchuck README for examples.echo Former::videoEncoder('video');

echo Former::wysiwyg('body');