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->modalTitle = $modalTitle;
|
||||
|
||||
if ($id) {
|
||||
$this->form->setBrand(BrandModel::byHashOrFail($id));
|
||||
}
|
||||
$id && $this->form->setBrand(BrandModel::byHashOrFail($id));
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -89,9 +89,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
||||
$this->method = $method;
|
||||
$this->modalTitle = $modalTitle;
|
||||
|
||||
if ($id) {
|
||||
$this->form->setCategory(CategoryModel::byHashOrFail($id));
|
||||
}
|
||||
$id && $this->form->setCategory(CategoryModel::byHashOrFail($id));
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -89,9 +89,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
||||
$this->method = $method;
|
||||
$this->modalTitle = $modalTitle;
|
||||
|
||||
if ($id) {
|
||||
$this->form->setChooseUs(ChooseUsModel::byHashOrFail($id));
|
||||
}
|
||||
$id && $this->form->setChooseUs(ChooseUsModel::byHashOrFail($id));
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -89,9 +89,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
||||
$this->method = $method;
|
||||
$this->modalTitle = $modalTitle;
|
||||
|
||||
if ($id) {
|
||||
$this->form->setPerfumeFeature(PerfumeFeatureModel::byHashOrFail($id));
|
||||
}
|
||||
$id && $this->form->setPerfumeFeature(PerfumeFeatureModel::byHashOrFail($id));
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -88,9 +88,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
||||
$this->method = $method;
|
||||
$this->modalTitle = $modalTitle;
|
||||
|
||||
if ($id) {
|
||||
$this->form->setExpense(ExpenseModel::byHashOrFail($id));
|
||||
}
|
||||
$id && $this->form->setExpense(ExpenseModel::byHashOrFail($id));
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -83,9 +83,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
||||
$this->method = $method;
|
||||
$this->modalTitle = $modalTitle;
|
||||
|
||||
if ($id) {
|
||||
$this->form->setBroadcast(BroadcastModel::byHashOrFail($id));
|
||||
}
|
||||
$id && $this->form->setBroadcast(BroadcastModel::byHashOrFail($id));
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -89,9 +89,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
||||
$this->method = $method;
|
||||
$this->modalTitle = $modalTitle;
|
||||
|
||||
if ($id) {
|
||||
$this->form->setFaq(FaqModel::byHashOrFail($id));
|
||||
}
|
||||
$id && $this->form->setFaq(FaqModel::byHashOrFail($id));
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -56,9 +56,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
||||
$this->method = $method;
|
||||
$this->modalTitle = $modalTitle;
|
||||
|
||||
if ($id) {
|
||||
$this->form->setCustomer(CustomerModel::byHashOrFail($id));
|
||||
}
|
||||
$id && $this->form->setCustomer(CustomerModel::byHashOrFail($id));
|
||||
}
|
||||
|
||||
public function create(): void
|
||||
|
||||
@ -178,9 +178,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
||||
$this->method = $method;
|
||||
$this->modalTitle = $modalTitle;
|
||||
|
||||
if ($id) {
|
||||
$this->form->setTier(TierModel::byHashOrFail($id));
|
||||
}
|
||||
$id && $this->form->setTier(TierModel::byHashOrFail($id));
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
@ -164,9 +164,7 @@ public function openModal(string $method, string $modalTitle, ?string $id = null
|
||||
$this->method = $method;
|
||||
$this->modalTitle = $modalTitle;
|
||||
|
||||
if ($id) {
|
||||
$this->form->setFormula(FormulaModel::byHashOrFail($id));
|
||||
}
|
||||
$id && $this->form->setFormula(FormulaModel::byHashOrFail($id));
|
||||
}
|
||||
|
||||
public function render(): View
|
||||
|
||||
Loading…
Reference in New Issue
Block a user