Просмотр файла app/Models/Transfer.php

Размер файла: 766B
<?php

declare(strict_types=1);

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * Class Transfer
 *
 * @property int    $id
 * @property int    $user_id
 * @property int    $recipient_id
 * @property string $text
 * @property int    $total
 * @property int    $created_at
 */
class Transfer extends BaseModel
{
    /**
     * Indicates if the model should be timestamped.
     */
    public $timestamps = false;

    /**
     * The attributes that aren't mass assignable.
     */
    protected $guarded = [];

    /**
     * Возвращает связь пользователей
     */
    public function recipientUser(): BelongsTo
    {
        return $this->belongsTo(User::class, 'recipient_id')->withDefault();
    }
}