Returns Model
Definition and Role
The Returns model represents product returns within the system. It manages the return process by linking return requests to customers, products, orders, and their associated details
Relationships
The Returns model defines various relationships with other models
- Order Item: Each return is associated with an order item that was purchased
public function item(): BelongsTo
{
return $this->belongsTo(OrderItem::class);
} - Buyer: Links the return to a specific buyer
public function buyer(): BelongsTo
{
return $this->belongsTo(Buyer::class, 'buyer_id');
} - Address: Each return has a related order address (morph relationship)
public function address(): MorphOne
{
return $this->morphOne(OrderAddress::class, 'addressable');
} - Product: Links the return to a specific product
public function product()
{
return $this->belongsTo(Product::class, 'shop_product_id');
} - Customer: Associates the return with a customer who requested it
public function customer(): BelongsTo
{
return $this->belongsTo(Customer::class, 'shop_customer_id');
} - Activity Logging: The model logs activities using the Spatie Activity Log package
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults();
}
Table Columns
- id
- status
- shop_product_id
- shop_customer_id
- buyer_id
- created_at
- updated_at