Skip to content

Commit 41057a3

Browse files
committed
Finish.
1 parent 10acf20 commit 41057a3

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

core/Application.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
namespace app\core;
44

55

6+
use app\core\db\Database;
7+
use app\core\db\DbModel;
8+
69
class Application
710
{
811
public static string $ROOT_DIR;
@@ -15,7 +18,7 @@ class Application
1518
public Database $db;
1619
public Session $session;
1720
public View $view;
18-
public ?Dbmodel $user;
21+
public ?UserModel $user;
1922

2023
public static Application $app;
2124
public ?Controller $controller = null;
@@ -65,7 +68,7 @@ public function setController(): Controller
6568
return $this->controller;
6669
}
6770

68-
public function login(DbModel $user): bool
71+
public function login(UserModel $user): bool
6972
{
7073
$this->user = $user;
7174
$primaryKey = $user->primaryKey();

core/UserModel.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace app\core;
44

5+
use app\core\db\DbModel;
6+
57
abstract class UserModel extends DbModel
68
{
79
abstract public function getDisplayName(): string;

core/Database.php renamed to core/db/Database.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22

3-
namespace app\core;
3+
namespace app\core\db;
4+
5+
use app\core\Application;
46

57
class Database
68
{

core/DbModel.php renamed to core/db/DbModel.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22

3-
namespace app\core;
3+
namespace app\core\db;
4+
5+
use app\core\Application;
6+
use app\core\Model;
47

58
abstract class DbModel extends Model
69
{

traits/ValidatePath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
trait ValidatePath
66
{
7-
public function validatePath($path)
7+
public function validatePath(string $path): string
88
{
99
// If path ends with /, remove / from end
1010
if ($path[-1] === '/')

views/login.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
<?php $form = \app\core\form\From::begin('/login', 'post') ?>
1111

12-
<?php echo $form->input($model, 'email'); ?>
13-
<?php echo $form->input($model, 'password')->passwordField(); ?>
12+
<?php echo $form->input($model, 'email', 'text'); ?>
13+
<?php echo $form->input($model, 'password', 'password'); ?>
1414

1515
<div class="mb-3 form-group">
1616
<button type="submit" class="btn btn-primary">Submit</button>

0 commit comments

Comments
 (0)