51 lines
1000 B
PHP
51 lines
1000 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class TailorRating extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'booking_id',
|
|
'customer_id',
|
|
'tailor_id',
|
|
'rating',
|
|
'review'
|
|
];
|
|
|
|
protected $casts = [
|
|
'id' => 'integer',
|
|
'booking_id' => 'integer',
|
|
'customer_id' => 'integer',
|
|
'tailor_id' => 'integer',
|
|
'rating' => 'decimal:1'
|
|
];
|
|
|
|
/**
|
|
* Get the booking that owns the rating.
|
|
*/
|
|
public function booking()
|
|
{
|
|
return $this->belongsTo(Booking::class);
|
|
}
|
|
|
|
/**
|
|
* Get the customer who gave the rating.
|
|
*/
|
|
public function customer()
|
|
{
|
|
return $this->belongsTo(User::class, 'customer_id');
|
|
}
|
|
|
|
/**
|
|
* Get the tailor who received the rating.
|
|
*/
|
|
public function tailor()
|
|
{
|
|
return $this->belongsTo(User::class, 'tailor_id');
|
|
}
|
|
}
|