feat: reviews

This commit is contained in:
2026-05-18 21:46:54 +02:00
parent bb409610a8
commit 67d838fa65
8 changed files with 358 additions and 2 deletions
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class PostReviews extends Model
{
use HasUlids;
protected $fillable = [
'meal_post_id',
'rating',
'comment',
'user_id',
];
public function mealPost(): BelongsTo
{
return $this->belongsTo(MealPosts::class, 'meal_post_id');
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
protected function casts(): array
{
return [
'id' => 'string',
'rating' => 'integer',
];
}
}