View file app/Models/Ignore.php

File size: 884B
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
 * Class Ignore
 *
 * @property int id
 * @property int user_id
 * @property int ignore_id
 * @property string text
 * @property int created_at
 */
class Ignore extends BaseModel
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'ignoring';

    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = false;

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

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