修复 blade hook 优先级被覆盖导致插件失效

This commit is contained in:
Edward Yang 2023-07-07 09:57:45 +08:00
parent 9529d68d38
commit e1a4d1b3cc
2 changed files with 16 additions and 15 deletions

View File

@ -64,7 +64,6 @@ class Hook
return $this->get($hook, $params, $callback, $htmlContent); return $this->get($hook, $params, $callback, $htmlContent);
} }
/** /**
* @param string $hook * @param string $hook
* @param array $params * @param array $params
@ -114,11 +113,15 @@ class Hook
$priority = null; $priority = null;
} }
if (isset($this->watch[$hook][$priority])) {
$priority++;
}
$this->watch[$hook][$priority] = [ $this->watch[$hook][$priority] = [
'function' => $function, 'function' => $function,
'caller' => [ 'caller' => [
//'file' => $caller['file'], 'file' => $caller['file'],
//'line' => $caller['line'], 'line' => $caller['line'],
'class' => Arr::get($caller, 'class'), 'class' => Arr::get($caller, 'class'),
], ],
]; ];

View File

@ -19,7 +19,6 @@ class HookServiceProvider extends ServiceProvider
}); });
} }
public function boot() public function boot()
{ {
$this->bootHookDirectives(); $this->bootHookDirectives();
@ -51,7 +50,6 @@ class HookServiceProvider extends ServiceProvider
}); });
} }
/** /**
* 添加 blade wrapper hook 标签 * 添加 blade wrapper hook 标签
* *