public function form($model)
    {
        $this->breadcrumb->onUserCreateOrEdit($model);
        return $this->form->of('antares.users', function (FormGrid $form) use ($model) {
                    $form->name('user.form');
                    $form->resource($this, 'antares::acl/index/users', $model);
                    $form->hidden('id');
                    $form->fieldset('User fields', function (Fieldset $fieldset) use($model) {
                        $fieldset->control('input:text', 'email')
                                ->label(trans('antares/foundation::label.users.email'));

                        $fieldset->control('input:text', 'firstname')
                                ->label(trans('antares/foundation::label.users.firstname'));

                        $fieldset->control('input:text', 'lastname')
                                ->label(trans('antares/foundation::label.users.lastname'));

                        $fieldset->control('input:password', 'password')
                                ->label(trans('antares/foundation::label.users.password'));

                        if ($model->id != user()->id) {
                            $status = $fieldset->control('input:checkbox', 'status')
                                    ->label(trans('antares/foundation::label.users.active'))
                                    ->value(1);
                            if ($model->status) {
                                $status->checked();
                            }
                        }

                        $fieldset->control('select', 'roles[]')
                                ->label(trans('antares/foundation::label.users.roles'))
                                ->options(function () {
                                    $roles = app('antares.role');
                                    if (config('antares/acl::allow_register_with_other_roles')) {
                                        return $roles->managers()->pluck('name', 'id');
                                    } else {
                                        return user()->roles->pluck('name', 'id');
                                    }
                                })
                                ->value(function ($row) {
                                    $roles = [];
                                    foreach ($row->roles as $row) {
                                        $roles[] = $row->id;
                                    }
                                    return $roles;
                                });
                        $fieldset->control('button', 'button')
                                ->attributes(['type' => 'submit', 'class' => 'btn btn--md btn--primary mdl-button mdl-js-button mdl-js-ripple-effect'])
                                ->value(trans('antares/foundation::label.save_changes'));

                        $fieldset->control('button', 'cancel')
                                ->field(function() {
                                    return app('html')->link(handles("antares::acl/index/users"), trans('antares/foundation::label.cancel'), ['class' => 'btn btn--md btn--default mdl-button mdl-js-button']);
                                });
                    });
                    $form->rules([
                        'email'     => ['required', 'email', 'unique:tbl_users,email' . ((!$model->exists) ? '' : ',' . $model->id)],
                        'firstname' => ['required'],
                        'lastname'  => ['required'],
                        'roles'     => ['required'],
                    ]);
                });
    }