hasData('delivery') && $cart->hasData('user')) { $this->zipExists($cart->invoice); $this->zipExists($cart->delivery); } return parent::check($cart); } public function import() { $json = file_get_contents(static::$jsonFile); $data = json_decode_strict($json); if (!$data || empty($data->zip_codes)) { return; } sqlGetConnection()->transactional( function () use ($data) { sqlQueryBuilder()->delete(self::$tableName)->where(\Query\Operator::equals(['country' => 'SK']))->execute(); foreach ($data->zip_codes as $post) { sqlQuery( 'INSERT IGNORE INTO '.self::$tableName.' SET zip = :psc, time_zone = :time_zone, country = :country', ['psc' => $post->zip, 'time_zone' => 0, 'country' => $post->country] ); } } ); } }