Skip to content

Commit

Permalink
remove span property from registered_customer_id field and refactor f…
Browse files Browse the repository at this point in the history
…ormBeforeSave method in Reservation Controller
  • Loading branch information
obinnaelviso committed Jul 23, 2024
1 parent 81c6fd9 commit 6801263
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 0 additions & 1 deletion resources/models/reservation.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@
'label' => 'lang:igniter.reservation::default.text_customer',
'type' => 'select',
'options' => [Igniter\User\Models\Customer::class, 'getDropdownOptions'],
'span' => 'left',
'placeholder' => 'lang:igniter.reservation::default.text_guest',
],
'first_name' => [
Expand Down
3 changes: 1 addition & 2 deletions src/Http/Controllers/Reservations.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ protected function getReserveTimeOptions($date = null)

public function formBeforeSave($model)
{
$registeredCustomerId = post('Reservation.registered_customer_id');
if ($registeredCustomerId) {
if ($registeredCustomerId = post('Reservation.registered_customer_id')) {
$registeredCustomer = Customer::findOrFail($registeredCustomerId);
$model->first_name = $registeredCustomer->first_name;
$model->last_name = $registeredCustomer->last_name;
Expand Down

0 comments on commit 6801263

Please sign in to comment.