Файл: app/Models/EmailChange.php
Строк: 31
<?php
declare(strict_types=1);
namespace AppModels;
use CarbonCarbonImmutable;
use IlluminateDatabaseEloquentModel;
use IlluminateDatabaseEloquentRelationsBelongsTo;
/**
* Class EmailChange
*
* @property int $id
* @property int $user_id
* @property string $email
* @property string $token
* @property CarbonImmutable $created_at
*/
class EmailChange extends Model
{
/**
* Indicates if the model should be timestamped.
*/
public $timestamps = false;
/**
* The attributes that aren't mass assignable.
*/
protected $guarded = [];
/**
* Get the attributes that should be cast.
*/
protected function casts(): array
{
return [
'user_id' => 'int',
'created_at' => 'datetime',
];
}
/**
* Возвращает связь пользователя
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id')->withDefault();
}
}