Файл: app/Models/Mailing.php
Строк: 42
<?php
declare(strict_types=1);
namespace AppModels;
use CarbonCarbonImmutable;
use IlluminateDatabaseEloquentModel;
use IlluminateDatabaseEloquentRelationsBelongsTo;
/**
* Class Mailing
*
* @property int $id
* @property int $user_id
* @property string $type
* @property string $subject
* @property string $text
* @property int $sent
* @property CarbonImmutable $created_at
* @property CarbonImmutable|null $sent_at
*/
class Mailing extends Model
{
/**
* The table associated with the model.
*/
protected $table = 'mailings';
/**
* The name of the "updated at" column.
*/
public const ?string UPDATED_AT = null;
/**
* The attributes that aren't mass assignable.
*/
protected $guarded = [];
/**
* Get the attributes that should be cast.
*/
protected function casts(): array
{
return [
'user_id' => 'int',
'sent_at' => 'datetime',
];
}
/**
* Возвращает связь пользователя
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id')->withDefault();
}
}