Implemented repository mapper, and venta show
This commit is contained in:
@ -3,6 +3,7 @@ namespace Incoviba\Repository;
|
||||
|
||||
use Incoviba\Common\Define;
|
||||
use Incoviba\Common\Ideal;
|
||||
use Incoviba\Common\Implement;
|
||||
use Incoviba\Model;
|
||||
|
||||
class User extends Ideal\Repository
|
||||
@ -15,15 +16,8 @@ class User extends Ideal\Repository
|
||||
|
||||
public function create(?array $data = null): Define\Model
|
||||
{
|
||||
$map = [
|
||||
'name' => [],
|
||||
'password' => [],
|
||||
'enabled' => [
|
||||
'function' => function($data) {
|
||||
return $data['enabled'] != 0;
|
||||
}
|
||||
]
|
||||
];
|
||||
$map = (new Implement\Repository\MapperParser(['name', 'password']))
|
||||
->register('enabled', new Implement\Repository\Mapper\Boolean('enabled'));
|
||||
return $this->parseData(new Model\User(), $data, $map);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user