You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
690 B
34 lines
690 B
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
class Review extends Model
|
|
{
|
|
use HasFactory;
|
|
protected $casts = [
|
|
'food_id' => 'integer',
|
|
'user_id' => 'integer',
|
|
'order_id' => 'integer',
|
|
'rating' => 'integer',
|
|
'created_at' => 'datetime',
|
|
'updated_at' => 'datetime'
|
|
];
|
|
|
|
public function food()
|
|
{
|
|
return $this->belongsTo(Food::class);
|
|
}
|
|
|
|
public function customer()
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
public function scopeActive($query)
|
|
{
|
|
return $query->where('status',1);
|
|
}
|
|
}
|
|
|