mirror of
https://github.com/igorsimdyanov/php8.git
synced 2025-08-13 14:45:09 +00:00
Глава 45: redis
This commit is contained in:
11
redis/mvc/models/user.php
Normal file
11
redis/mvc/models/user.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace MVC\Models;
|
||||
|
||||
class User
|
||||
{
|
||||
public function __construct(
|
||||
public string $email,
|
||||
private string $password,
|
||||
public ?string $first_name = null,
|
||||
public ?string $last_name = null) {}
|
||||
}
|
24
redis/mvc/models/users.php
Normal file
24
redis/mvc/models/users.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
namespace MVC\Models;
|
||||
|
||||
class Users
|
||||
{
|
||||
public $collection;
|
||||
|
||||
public function __construct(public ?array $users = null)
|
||||
{
|
||||
$users ??= [
|
||||
new User(
|
||||
'dmitry.koterov@gmail.com',
|
||||
'password',
|
||||
'Дмитрий',
|
||||
'Котеров'),
|
||||
new User(
|
||||
'igorsimdyanov@gmail.com',
|
||||
'password',
|
||||
'Игорь',
|
||||
'Симдянов')
|
||||
];
|
||||
$this->collection = $users;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user