laravel 5 - Extending fields doesn't create database columns in OctoberCMS -
i'm trying extend backend user fields in octobercms after adding new field if try save form there's error says field doesn't exist in database. how can add column new field? here's code:
public function boot() { // extend backend form usage event::listen('backend.form.extendfields', function($widget) { // user controller if (!$widget->getcontroller() instanceof \backend\controllers\users) { return; } // user model if (!$widget->model instanceof \backend\models\user) { return; } // add birthday field $widget->addtabfields([ 'birthday' => [ 'label' => 'birthday', 'comment' => 'select users birthday', 'type' => 'datepicker', 'tab' => 'billing' ] ]); }); }
extending model not automatically create fields in database you.
to create database fields, need create migration , run it.
the builder plugin offers nice way of graphically creating, applying , rolling migrations.
Comments
Post a Comment