20 lines
442 B
PHP
20 lines
442 B
PHP
<?php
|
|
|
|
namespace app\services;
|
|
|
|
use app\models\User;
|
|
use kernel\FormModel;
|
|
|
|
class UserService
|
|
{
|
|
|
|
public function create(FormModel $form_model): bool
|
|
{
|
|
$model = new User();
|
|
$model->username = $form_model->getItem('username');
|
|
$model->email = $form_model->getItem('email');
|
|
$model->password_hash = password_hash($form_model->getItem('password'), PASSWORD_DEFAULT);
|
|
return $model->save();
|
|
}
|
|
|
|
} |