@@ -110,10 +110,10 @@ protected function setupTransformers()
110110 * @param bool $truncate
111111 * @param bool $forceAll
112112 */
113- public function import ($ page = 1 , $ perPage = 5 , $ truncate = false , $ forceAll = false )
113+ public function import ($ postRestBase , $ page = 1 , $ perPage = 5 , $ truncate = false , $ forceAll = false )
114114 {
115115 $ this ->truncate ($ truncate )
116- ->fetchPosts ($ page , $ perPage , $ forceAll )
116+ ->fetchPosts ($ postRestBase , $ page , $ perPage , $ forceAll )
117117 ->map (function ($ post ) {
118118 return $ this ->transformPost ($ post );
119119 })
@@ -130,13 +130,13 @@ public function import($page = 1, $perPage = 5, $truncate = false, $forceAll = f
130130 * @param bool $forceAll
131131 * @return Collection
132132 */
133- protected function fetchPosts ($ page , $ perPage , $ forceAll )
133+ protected function fetchPosts ($ postRestBase , $ page , $ perPage , $ forceAll )
134134 {
135135 $ posts = collect ();
136136
137137 while (true ) {
138138 $ stop = collect (
139- $ this ->sendRequest ($ this ->makeUrl ($ page ++, $ perPage ))
139+ $ this ->sendRequest ($ this ->makeUrl ($ postRestBase , $ page ++, $ perPage ))
140140 )->map (function ($ post ) use ($ posts ) {
141141 $ posts ->push ($ post );
142142 })->isEmpty ();
@@ -191,10 +191,10 @@ protected function sendRequest($url, $tries = 3)
191191 * @param int $perPage
192192 * @return string
193193 */
194- protected function makeUrl ($ page , $ perPage )
194+ protected function makeUrl ($ postRestBase , $ page , $ perPage )
195195 {
196196 $ queryString = sprintf (
197- ' posts ?_embed=true&filter[orderby]=modified&page=%d&per_page=%d' ,
197+ "{ $ postRestBase } ?_embed=true&filter[orderby]=modified&page=%d&per_page=%d " ,
198198 $ page , $ perPage
199199 );
200200
0 commit comments