Cart.php 654 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Models;
  3. use App\Models\User;
  4. use App\Models\Address;
  5. use Illuminate\Database\Eloquent\Model;
  6. class Cart extends Model
  7. {
  8. protected $guarded = [];
  9. protected $fillable = ['address_id','price','tax','shipping_cost','discount','product_referral_code','coupon_code','coupon_applied','quantity','user_id','temp_user_id','owner_id','product_id','variation'];
  10. public function user()
  11. {
  12. return $this->belongsTo(User::class);
  13. }
  14. public function product()
  15. {
  16. return $this->belongsTo(Product::class);
  17. }
  18. public function address()
  19. {
  20. return $this->belongsTo(Address::class);
  21. }
  22. }