diff --git a/app/Models/Cart.php b/app/Models/Cart.php index fc21497..3217903 100644 --- a/app/Models/Cart.php +++ b/app/Models/Cart.php @@ -27,11 +27,21 @@ class Cart extends Model return $this->belongsTo(City::class); } + public function getCity(): City + { + return City::where('city_id', $this->city_id)->first(); + } + public function company(): BelongsTo { return $this->belongsTo(Company::class); } + public function getCompany(): Company + { + return Company::where('company_id', $this->company_id)->first(); + } + public function items(): BelongsToMany { return $this->belongsToMany(Item::class, 'carts_items', 'cart_id', 'item_id');