refactor(modal): Simplify modal ID handling by replacing if statements with short-circuit evaluation across multiple components.
This commit is contained in:
parent
1f29e4193d
commit
ffba4df0dc
@ -89,9 +89,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
|||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
$this->modalTitle = $modalTitle;
|
$this->modalTitle = $modalTitle;
|
||||||
|
|
||||||
if ($id) {
|
$id && $this->form->setBrand(BrandModel::byHashOrFail($id));
|
||||||
$this->form->setBrand(BrandModel::byHashOrFail($id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
|
|||||||
@ -89,9 +89,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
|||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
$this->modalTitle = $modalTitle;
|
$this->modalTitle = $modalTitle;
|
||||||
|
|
||||||
if ($id) {
|
$id && $this->form->setCategory(CategoryModel::byHashOrFail($id));
|
||||||
$this->form->setCategory(CategoryModel::byHashOrFail($id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
|
|||||||
@ -89,9 +89,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
|||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
$this->modalTitle = $modalTitle;
|
$this->modalTitle = $modalTitle;
|
||||||
|
|
||||||
if ($id) {
|
$id && $this->form->setChooseUs(ChooseUsModel::byHashOrFail($id));
|
||||||
$this->form->setChooseUs(ChooseUsModel::byHashOrFail($id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
|
|||||||
@ -89,9 +89,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
|||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
$this->modalTitle = $modalTitle;
|
$this->modalTitle = $modalTitle;
|
||||||
|
|
||||||
if ($id) {
|
$id && $this->form->setPerfumeFeature(PerfumeFeatureModel::byHashOrFail($id));
|
||||||
$this->form->setPerfumeFeature(PerfumeFeatureModel::byHashOrFail($id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
|
|||||||
@ -88,9 +88,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
|||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
$this->modalTitle = $modalTitle;
|
$this->modalTitle = $modalTitle;
|
||||||
|
|
||||||
if ($id) {
|
$id && $this->form->setExpense(ExpenseModel::byHashOrFail($id));
|
||||||
$this->form->setExpense(ExpenseModel::byHashOrFail($id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
|
|||||||
@ -83,9 +83,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
|||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
$this->modalTitle = $modalTitle;
|
$this->modalTitle = $modalTitle;
|
||||||
|
|
||||||
if ($id) {
|
$id && $this->form->setBroadcast(BroadcastModel::byHashOrFail($id));
|
||||||
$this->form->setBroadcast(BroadcastModel::byHashOrFail($id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
|
|||||||
@ -89,9 +89,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
|||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
$this->modalTitle = $modalTitle;
|
$this->modalTitle = $modalTitle;
|
||||||
|
|
||||||
if ($id) {
|
$id && $this->form->setFaq(FaqModel::byHashOrFail($id));
|
||||||
$this->form->setFaq(FaqModel::byHashOrFail($id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
|
|||||||
@ -56,9 +56,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
|||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
$this->modalTitle = $modalTitle;
|
$this->modalTitle = $modalTitle;
|
||||||
|
|
||||||
if ($id) {
|
$id && $this->form->setCustomer(CustomerModel::byHashOrFail($id));
|
||||||
$this->form->setCustomer(CustomerModel::byHashOrFail($id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create(): void
|
public function create(): void
|
||||||
|
|||||||
@ -178,9 +178,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
|||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
$this->modalTitle = $modalTitle;
|
$this->modalTitle = $modalTitle;
|
||||||
|
|
||||||
if ($id) {
|
$id && $this->form->setTier(TierModel::byHashOrFail($id));
|
||||||
$this->form->setTier(TierModel::byHashOrFail($id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
|
|||||||
@ -164,9 +164,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
|||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
$this->modalTitle = $modalTitle;
|
$this->modalTitle = $modalTitle;
|
||||||
|
|
||||||
if ($id) {
|
$id && $this->form->setFormula(FormulaModel::byHashOrFail($id));
|
||||||
$this->form->setFormula(FormulaModel::byHashOrFail($id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render(): View
|
public function render(): View
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user