Example #1
0
 /**
  * Handle `orchestra.form: user.account` event.
  *
  * @param  \Orchestra\Model\User  $user
  * @param  \Orchestra\Contracts\Html\Form\Builder  $form
  *
  * @return void
  */
 public function handle($user, FormBuilder $form)
 {
     if (!$this->isLocaltimeEnabled()) {
         return;
     }
     $form->extend(function (FormGrid $form) {
         $form->fieldset('Timezone', function (Fieldset $fieldset) {
             $fieldset->control('select', 'meta_timezone')->label('Timezone')->options(Model::lists())->value(function ($row) {
                 $meta = $this->memory->make('user');
                 return $meta->get("timezone.{$row->id}", $this->config->get('app.timezone'));
             });
         });
     });
 }
Example #2
0
 /**
  * Setup the form.
  *
  * @param  \Illuminate\Support\Fluent  $model
  * @param  \Orchestra\Contracts\Html\Form\Builder  $form
  *
  * @return void
  */
 protected function form(Fluent $model, FormBuilder $form)
 {
     $form->extend(function ($form) use($model) {
         $form->fieldset('Page Management', function ($fieldset) {
             $pages = Content::page()->publish()->lists('title', 'slug');
             if ($pages instanceof Arrayable) {
                 $pages = $pages->toArray();
             }
             $pages = array_merge(['_posts_' => 'Display Posts'], $pages);
             $fieldset->control('select', 'default_format')->label('Default Format')->options(StoryFormat::getParsers());
             $fieldset->control('select', 'default_page')->label('Default Page')->options($pages);
             $fieldset->control('text', 'Page Permalink', 'page_permalink');
             $fieldset->control('text', 'Post Permalink', 'post_permalink');
         });
     });
 }
Example #3
0
 /**
  * Setup the form.
  *
  * @param  \Illuminate\Support\Fluent $model
  * @param  \Orchestra\Contracts\Html\Form\Builder  $form
  *
  * @return void
  */
 protected function form(Fluent $model, FormBuilder $form)
 {
     $form->extend(function (FormGrid $form) {
         $form->fieldset('Role Configuration', function (Fieldset $fieldset) {
             $roles = Role::lists('name', 'id');
             $fieldset->control('select', 'admin_role')->label(trans('orchestra/control::label.roles.admin'))->options($roles);
             $fieldset->control('select', 'member_role')->label(trans('orchestra/control::label.roles.member'))->options($roles);
         });
         $form->fieldset('Timezone', function (Fieldset $fieldset) {
             $agreement = ['yes' => 'Yes', 'no' => 'No'];
             $fieldset->control('select', 'localtime')->attributes(['role' => 'agreement'])->label(trans('orchestra/control::label.enable-timezone'))->options($agreement)->value(function ($row) {
                 return $row->localtime === true ? 'yes' : 'no';
             });
         });
     });
 }