Skip to content

Commit 06a51fe

Browse files
committed
refactor: change return type of LoginModel::recordLoginAttempt() to void
1 parent ccf9c1b commit 06a51fe

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Models/LoginModel.php

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

33
namespace CodeIgniter\Shield\Models;
44

5-
use CodeIgniter\Database\BaseResult;
65
use CodeIgniter\I18n\Time;
76
use CodeIgniter\Model;
87
use CodeIgniter\Shield\Entities\Login;
@@ -11,6 +10,8 @@
1110

1211
class LoginModel extends Model
1312
{
13+
use CheckQueryReturnTrait;
14+
1415
protected $table = 'auth_logins';
1516
protected $primaryKey = 'id';
1617
protected $returnType = Login::class;
@@ -36,24 +37,24 @@ class LoginModel extends Model
3637

3738
/**
3839
* @param int|string|null $userId
39-
*
40-
* @return BaseResult|false|int|object|string
4140
*/
4241
public function recordLoginAttempt(
4342
string $identifier,
4443
bool $success,
4544
?string $ipAddress = null,
4645
?string $userAgent = null,
4746
$userId = null
48-
) {
49-
return $this->insert([
47+
): void {
48+
$return = $this->insert([
5049
'ip_address' => $ipAddress,
5150
'user_agent' => $userAgent,
5251
'identifier' => $identifier,
5352
'user_id' => $userId,
5453
'date' => date('Y-m-d H:i:s'),
5554
'success' => (int) $success,
5655
]);
56+
57+
$this->checkQueryReturn($return);
5758
}
5859

5960
/**

0 commit comments

Comments
 (0)