app/Models/Comment.php
<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\MorphTo;
/**
* Class Comment
*
* @property int id
* @property int user_id
* @property string relate_type
* @property int relate_id
* @property string text
* @property string ip
* @property string brow
* @property int created_at
*/
class Comment extends BaseModel
{
/**
* Indicates if the model should be timestamped.
*/
public $timestamps = false;
/**
* The attributes that aren't mass assignable.
*/
protected $guarded = [];
/**
* Morph name
*/
public static string $morphName = 'comments';
/**
* Возвращает связанные объекты
*/
public function relate(): MorphTo
{
return $this->morphTo('relate');
}
}