<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* @property int $earn_point
*/
class OrderDetail extends Model {
protected $fillable = [
'order_id',
'seller_id',
'product_id',
'variation',
'price',
'tax',
'shipping_cost',
'quantity',
'payment_status',
'delivery_status',
'shipping_type',
'pickup_point_id',
'product_referral_code',
'earn_point',
'delivery_service_id'
];
public function order() {
return $this->belongsTo(Order::class);
}
public function product() {
return $this->belongsTo(Product::class);
}
public function pickup_point() {
return $this->belongsTo(PickupPoint::class);
}
public function refund_request() {
return $this->hasOne(RefundRequest::class);
}
public function affiliate_log() {
return $this->hasMany(AffiliateLog::class);
}
public function getFormatedShippingTypeAttribute(){
return ucfirst(strtolower($this->shipping_type));
}
public function deliveryService(){
return $this->hasOne(DeliveryService::class);
}
}
|