mirror of
https://gitee.com/ctexthuang/hyperf-micro-svc.git
synced 2026-02-08 18:30:16 +08:00
20 lines
485 B
PHP
20 lines
485 B
PHP
<?php
|
|
|
|
namespace App\Repository\Traits;
|
|
|
|
use function Hyperf\Support\class_basename;
|
|
use function Hyperf\Support\class_uses_recursive;
|
|
|
|
trait BootTrait
|
|
{
|
|
protected function startBoot(...$params): void
|
|
{
|
|
$traits = class_uses_recursive(static::class);
|
|
foreach ($traits as $trait) {
|
|
$method = 'boot' . class_basename($trait);
|
|
if (method_exists($this, $method)) {
|
|
$this->{$method}(...$params);
|
|
}
|
|
}
|
|
}
|
|
} |