QueenFruits/Backend/app/Models/ProductReview.php

43 lines
924 B
PHP

<?php
namespace App\Models;
use App\Traits\Multitenantable;
use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;
class ProductReview extends Model
{
use Multitenantable;
protected $primaryKey = 'uuid';
public $incrementing = false;
protected $keyType = 'string';
protected $fillable = [
'uuid',
'tenant_id',
'customer_id',
'product_variant_id',
'rating',
'comment'
];
protected $casts = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
protected function serializeDate(DateTimeInterface $date)
{
return $date->format('Y-m-d H:i:s');
}
public function customer() {
return $this->belongsTo(Customer::class, 'customer_id', 'uuid');
}
public function variant() {
return $this->belongsTo(ProductVariant::class, 'product_variant_id', 'uuid');
}
}