/** * Returns a collection with shipping rules. * * @return Collection */ public function all() { return ShippingRule::with('carrier', 'country')->join('carriers', 'carriers.id', '=', 'shipping_rules.carrier_id')->join('countries', 'countries.id', '=', 'shipping_rules.country_id')->orderBy('carriers.name')->orderBy('countries.name')->select('shipping_rules.*')->get(); }
/** * Execute the command. * * @param ShippingRuleRepository $rules * @return ShippingRule */ public function handle(ShippingRuleRepository $rules) { $rule = ShippingRule::register($this->carrier_id, $this->country_id); $rules->save($rule); return $rule; }