first change

This commit is contained in:
2025-07-27 17:40:56 +05:45
commit f8b9a6725b
3152 changed files with 229528 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace Modules\PMS\Models;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
class Comment extends Model
{
/**
* The attributes that are mass assignable.
*/
protected $fillable = ['content', 'comment_by'];
// protected $casts = [
// 'created_at' => 'datetime',
// ];
protected function createdAtFormatted(): Attribute
{
return Attribute::make(
get: fn($value, $attributes) => Carbon::parse($attributes['created_at'])->format('d, M Y H:i'),
);
}
public function comments()
{
return $this->morphMany(Comment::class, 'commentable');
}
public function user()
{
return $this->belongsTo(User::class, 'comment_by');
}
}