/** * Make a form builder. * * @return Form */ public function form() { return Admin::form(Permission::class, function (Form $form) { $form->display('id', 'ID'); $form->text('slug', trans('admin::lang.slug'))->rules('required'); $form->text('name', trans('admin::lang.name'))->rules('required'); $form->display('created_at', trans('admin::lang.created_at')); $form->display('updated_at', trans('admin::lang.updated_at')); }); }
/** * Make a form builder. * * @return Form */ public function form() { return Admin::form(Role::class, function (Form $form) { $form->display('id', 'ID'); $form->text('slug', trans('admin::lang.slug'))->rules('required'); $form->text('name', trans('admin::lang.name'))->rules('required'); $form->multipleSelect('permissions', trans('admin::lang.permissions'))->options(Permission::all()->pluck('name', 'id')); $form->display('created_at', trans('admin::lang.created_at')); $form->display('updated_at', trans('admin::lang.updated_at')); }); }
/** * Make a form builder. * * @return Form */ public function form() { return Admin::form(Administrator::class, function (Form $form) { $form->display('id', 'ID'); $form->text('username', trans('admin::lang.username'))->rules('required'); $form->text('name', trans('admin::lang.name'))->rules('required'); $form->password('password', trans('admin::lang.password'))->rules('required'); $form->multipleSelect('roles', trans('admin::lang.roles'))->options(Role::all()->pluck('name', 'id')); $form->display('created_at', trans('admin::lang.created_at')); $form->display('updated_at', trans('admin::lang.updated_at')); $form->saving(function (Form $form) { if ($form->password && $form->model()->password != $form->password) { $form->password = bcrypt($form->password); } }); }); }
/** * Make a form builder. * * @return Form */ public function form() { return Admin::form(Menu::class, function (Form $form) { $form->display('id', 'ID'); $options = [0 => 'Root'] + Menu::buildSelectOptions(); $form->select('parent_id', trans('admin::lang.parent_id'))->options($options); $form->text('title', trans('admin::lang.title'))->rules('required'); $form->text('icon', trans('admin::lang.icon'))->default('fa-bars')->rules('required'); $form->text('uri', trans('admin::lang.uri')); $form->multipleSelect('roles', trans('admin::lang.roles'))->options(Role::all()->pluck('name', 'id')); $form->display('created_at', trans('admin::lang.created_at')); $form->display('updated_at', trans('admin::lang.updated_at')); }); }