Файл: app/Models/Poll.php
Строк: 33
<?php
declare(strict_types=1);
namespace AppModels;
use CarbonCarbonImmutable;
use IlluminateDatabaseEloquentModel;
use IlluminateDatabaseEloquentRelationsBelongsTo;
/**
* Class Poll
*
* @property int $id
* @property string $relate_type
* @property int $relate_id
* @property int $user_id
* @property string $vote
* @property CarbonImmutable $created_at
*/
class Poll extends Model
{
/**
* 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',
];
}
/**
* Возвращает связь пользователя
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id')->withDefault();
}
}