feat: add comments for controller and model and blade for dashboard for user

This commit is contained in:
2026-08-18 14:26:23 +03:30
parent 5c1af64281
commit 7cd7c804ec
4 changed files with 175 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class Comment
*
* @property int $id
* @property int|null $user_id
* @property string|null $guest_name
* @property int $commentable_id
* @property string $commentable_type
* @property string $body
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @property User|null $user
*
* @package App\Models
*/
class Comment extends Model
{
protected $table = 'comments';
protected $casts = [
'user_id' => 'int',
'commentable_id' => 'int'
];
protected $fillable = [
'user_id',
'guest_name',
'commentable_id',
'commentable_type',
'body'
];
public function commentable()
{
return $this->morphTo();
}
public function user()
{
return $this->belongsTo(User::class);
}
}