Files
besttechfrom.eu/app/Models/Comment.php
T

37 lines
672 B
PHP
Raw Normal View History

2026-02-06 15:13:20 +02:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Comment extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'user_id',
'product_id',
'body',
];
/**
* Get the user that owns the comment.
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* Get the product that owns the comment.
*/
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}
}