Changeset View
Changeset View
Standalone View
Standalone View
src/app/UserPassword.php
<?php | <?php | ||||
namespace App; | namespace App; | ||||
use App\Traits\BelongsToUserTrait; | |||||
use Illuminate\Database\Eloquent\Model; | use Illuminate\Database\Eloquent\Model; | ||||
/** | /** | ||||
* A password history entry of a User. | * A password history entry of a User. | ||||
* | * | ||||
* @property int $id | * @property int $id | ||||
* @property int $user_id | * @property int $user_id | ||||
* @property string $password | * @property string $password | ||||
*/ | */ | ||||
class UserPassword extends Model | class UserPassword extends Model | ||||
{ | { | ||||
use BelongsToUserTrait; | |||||
/** @var bool Indicates if the model should be timestamped. */ | /** @var bool Indicates if the model should be timestamped. */ | ||||
public $timestamps = false; | public $timestamps = false; | ||||
/** @var array<string, string> The attributes that should be cast. */ | /** @var array<string, string> The attributes that should be cast. */ | ||||
protected $casts = [ | protected $casts = [ | ||||
'created_at' => 'datetime:Y-m-d H:i:s', | 'created_at' => 'datetime:Y-m-d H:i:s', | ||||
]; | ]; | ||||
/** @var array<int, string> The attributes that are mass assignable. */ | /** @var array<int, string> The attributes that are mass assignable. */ | ||||
protected $fillable = ['user_id', 'password']; | protected $fillable = ['user_id', 'password']; | ||||
/** @var array<int, string> The attributes that should be hidden for arrays. */ | /** @var array<int, string> The attributes that should be hidden for arrays. */ | ||||
protected $hidden = ['password']; | protected $hidden = ['password']; | ||||
/** | |||||
* The user to which this entry belongs. | |||||
* | |||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | |||||
*/ | |||||
public function user() | |||||
{ | |||||
return $this->belongsTo(User::class, 'user_id', 'id'); | |||||
} | |||||
} | } |