Skip to content

Commit ed38172

Browse files
committed
Handle multiple dynamic route segments
1 parent e58748c commit ed38172

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/AbstractJob.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ protected function setup()
4242
unset($this->params['id']);
4343
}
4444

45+
// Next we need to replace any segments with our params.
46+
foreach ($this->params as $param => $value) {
47+
if (is_array($value)) {
48+
continue;
49+
}
50+
if (strpos($this->endpoint, "{{$param}}") !== false) {
51+
$this->endpoint = str_replace("{{$param}}",$value, $this->endpoint);
52+
unset($this->params[$param]);
53+
}
54+
}
4555
$request = new Request($this->endpoint, $method, $this->params);
4656

4757
if (! empty($this->decorator)) {

0 commit comments

Comments
 (0)