Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Model;
- use Nette;
- final class UserManager extends Nette\Application\UI\Presenter {
- use Nette\SmartObject;
- private Nette\Database\Explorer $database;
- public function __construct($database) {
- $this->database = $database;
- }
- public function userExists(Nette\Database\Explorer $database, $user): ?Nette\Database\Table\ActiveRow {
- return $database->table('Users')->where('Name' , $user)->fetch();
- }
- public function redirectUser(): void {
- if (!$this->user->isLoggedIn()) {
- $this->flashMessage('Nepřihlášen', 'warning');
- $this->redirect('Homepage:');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment