Decoy

A Laravel model-based CMS
By Bukwild

View on GitHub
Case study

Custom form fields

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.

Belongs To

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());

Boolean

echo Former::boolean('featured')->message('Yes, featured')

Checklist

echo Former::checklist('category')->from([
	'car' => 'Red Car',
	'bus' => 'Big bus'
]);
// In your model
protected $casts = [
    'category' => 'array',
];

Date

echo Former::date('date', 'Start date')->value('now');

DateTime

echo Former::datetime('when')->date(array('data-example', 'Hey'))->value('now');

Image

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

Listing

echo Former::listing('Author')->take(30)->layout('form');

Many To Many Checklist

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');
	});

Note

echo Former::note('Creator', $author->name);

Radiolist

echo Former::radiolist('category')->from([
	'car' => 'Red Car',
	'bus' => 'Big bus'
]);

Time

echo Former::time('time')->value('now');

Upload

echo Former::upload('file');

Video Encoder

echo Former::videoEncoder('video');

WYSIWYG

echo Former::wysiwyg('body');