Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
deatil committed Jul 24, 2024
1 parent 80e3d0c commit 70b8c24
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/Flash/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ public function __set(string $component, $value)

$component = $this->handle . ':' . $component;

if ($this->type == 'action') {
AdminEvent::action()->listen($component, $value, $weight);
} else {
if ($this->type == 'filter') {
AdminEvent::filter()->listen($component, $value, $weight);
} else {
AdminEvent::action()->listen($component, $value, $weight);
}
}

Expand All @@ -92,15 +92,16 @@ public function __set(string $component, $value)
*
* @param string $component 当前组件
* @param mixed $args 参数
* @return mixed
*/
public function call(string $component, ...$args)
{
$component = $this->handle . ':' . $component;

if ($this->type == 'action') {
AdminEvent::action()->trigger($component, ...$args);
} else {
if ($this->type == 'filter') {
return AdminEvent::filter()->trigger($component, ...$args);
} else {
AdminEvent::action()->trigger($component, ...$args);
}
}

Expand All @@ -109,6 +110,7 @@ public function call(string $component, ...$args)
*
* @param string $component 当前组件
* @param array $args 参数
* @return mixed
*/
public function __call(string $component, array $args)
{
Expand Down

0 comments on commit 70b8c24

Please sign in to comment.