diff --git a/packages/panels/src/Navigation/MenuItem.php b/packages/panels/src/Navigation/MenuItem.php index 20ccc2c130..bf184ae766 100644 --- a/packages/panels/src/Navigation/MenuItem.php +++ b/packages/panels/src/Navigation/MenuItem.php @@ -8,8 +8,6 @@ use Laravel\SerializableClosure\Serializers\Native; class MenuItem extends Component { - protected string | Closure | null $postAction = null; - /** * @var string | array{50: string, 100: string, 200: string, 300: string, 400: string, 500: string, 600: string, 700: string, 800: string, 900: string, 950: string} | Closure | null */ @@ -19,6 +17,8 @@ class MenuItem extends Component protected string | Closure | null $label = null; + protected string | Closure | null $postAction = null; + protected int | Closure | null $sort = null; protected string | Closure | Native | null $url = null; @@ -65,6 +65,13 @@ class MenuItem extends Component return $this; } + public function postAction(string | Closure | null $action): static + { + $this->postAction = $action; + + return $this; + } + public function sort(int | Closure | null $sort): static { $this->sort = $sort; @@ -80,13 +87,6 @@ class MenuItem extends Component return $this; } - public function postAction(string | Closure | null $action): static - { - $this->postAction = $action; - - return $this; - } - public function openUrlInNewTab(bool | Closure $condition = true): static { $this->shouldOpenUrlInNewTab = $condition; @@ -140,6 +140,11 @@ class MenuItem extends Component return $this->evaluate($this->label); } + public function getPostAction(): ?string + { + return $this->evaluate($this->postAction); + } + public function getSort(): int { return $this->evaluate($this->sort) ?? -1; @@ -150,11 +155,6 @@ class MenuItem extends Component return $this->evaluate($this->url); } - public function getPostAction(): ?string - { - return $this->evaluate($this->postAction); - } - public function shouldOpenUrlInNewTab(): bool { return (bool) $this->evaluate($this->shouldOpenUrlInNewTab);