function __construct() { parent::controllerClass('Sections'); parent::headerPlural('Sections'); parent::headerSingular('Section'); parent::baseRoute('/admin/sections'); parent::ajaxBaseRoute('/ajax/admin/sections'); parent::table(new Section()); parent::attributes([['title' => 'ID', 'id' => 'id'], ['title' => 'Name', 'id' => 'name'], ['title' => 'Template', 'id' => 'template.name'], ['title' => 'Single Post', 'id' => 'single']]); parent::inputs(function ($row) { return ['name' => (new TextBox())->id('name')->label('Name')->defaultValue($row ? $row->name : ''), 'description' => (new PlainTextAreaBox())->id('description')->label('Description')->defaultValue($row ? $row->description : ''), 'template_id' => (new DropDown())->id('template_id')->nullable(false)->label('Template')->idField('id')->nameField('name')->rows(Template::get())->defaultValue($row ? $row->template_id : ''), 'single' => (new Checkbox())->id('single')->label('Single Post?')->defaultValue($row ? $row->single : '')]; }); parent::tableName('section'); }