Skip to content

Commit ee3aea1

Browse files
committed
Fix channel match
1 parent 83ed698 commit ee3aea1

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/FlowRouter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ public function widthMatchers($matchers): FlowRouter
4242
return $this;
4343
}
4444

45-
public function add($route, $flow, $channel='public'): FlowRouter
45+
public function add($route, $flow, $channel=null): FlowRouter
4646
{
47-
$channel = Helper::getFlowChannel($channel);
47+
$channel = $channel ?? Helper::getFlowChannel($flow);
4848
$flow = Helper::getFlowUniqueId($flow);
4949
if ($route && $flow) {
5050
$this->routes[] = compact('route', 'flow', 'channel');
5151
}
5252
return $this;
5353
}
5454

55-
public function prepend($route, $flow, $channel='public'): FlowRouter
55+
public function prepend($route, $flow, $channel=null): FlowRouter
5656
{
57-
$channel = Helper::getFlowChannel($channel);
57+
$channel = $channel ?? Helper::getFlowChannel($flow);
5858
$flow = Helper::getFlowUniqueId($flow);
5959
if ($route && $flow) {
6060
array_unshift($this->routes, compact('route', 'flow', 'channel'));

src/Support/Helper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ public static function getFlowUniqueId($flow)
6161
}
6262
return $flow;
6363
}
64-
public static function getFlowChannel($flow,$default=null){
64+
public static function getFlowChannel($flow){
6565
if($flow instanceof Flow){
6666
return $flow->channel;
6767
}
68-
return $default;
68+
return null;
6969
}
7070

7171
}

0 commit comments

Comments
 (0)