Skip to content

4.17.86-beta: issue #30

Compare
Choose a tag to compare
@butschster butschster released this 15 Mar 08:24
· 2617 commits to development since this release

Added new display column type Column\Editabe for editing table data in place.

Example

// Display
$model->onDisplay(function () {
   return AdminDisplay::table()->setApply(function($query) {
      $query->orderBy('date', 'desc');
   })->setColumns([
      AdminColumn::link('title')->setLabel('Title'),
      ...
      AdminColumnEditable::checkbox('published', 'Yes', 'No')->setLabel('Published'),
      ...
   ])->paginate(5);
});

For editing used jquery plugin http://vitalets.github.io/x-editable/ . Need help with creating other column types

IMPORTANT! After composer update you should remove assets public\packages\sleepingowl, config sleeping_owl.php and run artisan command php artisan sleepingowl:install


Sometimes, form has field (for example: password), which should not update if empty.

Example

User model App\User has field password

// Create And Edit
$model->onCreate(function() {
    return AdminForm::panel()->addBody([
        ...
        AdminFormElement::password('password', 'Password')->required()->addValidationRule('min:6'),
       ...
    ]);
});


$model->onEdit(function() {
    return AdminForm::panel()->addBody([
        ...
        AdminFormElement::password('password', 'Password')->updateIfFilled(), // or updateIfNotEmpty()
       ...
    ]);
});

Enjoy!