Changeset View
Changeset View
Standalone View
Standalone View
src/app/AuthAttempt.php
<?php | <?php | ||||
namespace App; | namespace App; | ||||
use Illuminate\Database\Eloquent\Model; | use Illuminate\Database\Eloquent\Model; | ||||
use Iatstuti\Database\Support\NullableFields; | use Iatstuti\Database\Support\NullableFields; | ||||
use App\Traits\UuidKeyTrait; | |||||
use Carbon\Carbon; | use Carbon\Carbon; | ||||
/** | /** | ||||
* The eloquent definition of an AuthAttempt. | * The eloquent definition of an AuthAttempt. | ||||
* | * | ||||
* An AuthAttempt represents an authenticaton attempt from an application/client. | * An AuthAttempt represents an authenticaton attempt from an application/client. | ||||
*/ | */ | ||||
class AuthAttempt extends Model | class AuthAttempt extends Model | ||||
{ | { | ||||
use NullableFields; | use NullableFields; | ||||
use UuidKeyTrait; | |||||
// No specific reason | // No specific reason | ||||
public const REASON_NONE = ''; | public const REASON_NONE = ''; | ||||
// Password mismatch | // Password mismatch | ||||
public const REASON_PASSWORD = 'password'; | public const REASON_PASSWORD = 'password'; | ||||
// Geolocation whitelist mismatch | // Geolocation whitelist mismatch | ||||
public const REASON_GEOLOCATION = 'geolocation'; | public const REASON_GEOLOCATION = 'geolocation'; | ||||
Show All 13 Lines | protected $fillable = [ | ||||
'last_seen', | 'last_seen', | ||||
]; | ]; | ||||
protected $casts = [ | protected $casts = [ | ||||
'expires_at' => 'datetime', | 'expires_at' => 'datetime', | ||||
'last_seen' => 'datetime' | 'last_seen' => 'datetime' | ||||
]; | ]; | ||||
public $incrementing = false; | |||||
protected $keyType = 'string'; | |||||
/** | /** | ||||
* Prepare a date for array / JSON serialization. | * Prepare a date for array / JSON serialization. | ||||
* | * | ||||
* Required to not omit timezone and match the format of update_at/created_at timestamps. | * Required to not omit timezone and match the format of update_at/created_at timestamps. | ||||
* | * | ||||
* @param \DateTimeInterface $date | * @param \DateTimeInterface $date | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |