public function submitFormNew(Form $form) { $values = $form->getValues(); $this->model->insert(array('name' => $values->name == '' ? null : $values->name, 'surname' => $values->surname == '' ? null : $values->surname, 'email' => $values->email, 'password' => md5($values->password), 'created' => new \DateTime(), 'role_id' => $values->role_id)); $this->flashMessage($this->translator->translate('admin.text.inserted')); $this->redirect('default'); }
/** * Do the migration */ public function up() { Capsule::schema()->create('users', function ($table) { $table->increments('id'); $table->string('username'); $table->string('email')->unique()->nullable(); $table->string('password'); $table->integer('group_id'); $table->integer('status'); $table->timestamps(); }); $array = array(array('username' => 'admin', 'email' => '*****@*****.**', 'password' => '$2y$10$ElXh/aFKLN1Vf4t2G0DTnupWcEpS2/2OP8fIsQXjHp7KXE3bjcUke', 'group_id' => '1', 'status' => '1'), array('username' => 'moderator', 'email' => '*****@*****.**', 'password' => '$2y$10$ElXh/aFKLN1Vf4t2G0DTnupWcEpS2/2OP8fIsQXjHp7KXE3bjcUke', 'group_id' => '1', 'status' => '1'), array('username' => 'user', 'email' => '*****@*****.**', 'password' => '$2y$10$ElXh/aFKLN1Vf4t2G0DTnupWcEpS2/2OP8fIsQXjHp7KXE3bjcUke', 'group_id' => '1', 'status' => '1')); Users::insert($array); }