Advertisement
Guest User

Untitled

a guest
Nov 26th, 2022
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Modules\Basic\Http\Livewire\Setup;
  4.  
  5. use Illuminate\View\View;
  6. use Livewire\Component;
  7. use Modules\Basic\Enums\BasicParameter;
  8. use Modules\Basic\Helper\ParameterHelper;
  9.  
  10. class Stepper extends Component
  11. {
  12.     // General
  13.     public int $currentStep = 1;
  14.  
  15.     // Step 2
  16.     public string $name = '';
  17.     public string $language = '';
  18.  
  19.  
  20.     public function mount()
  21.     {
  22.         // Get the current setup step from the db
  23.         // Add 1 to the step, because index starts at 0
  24.         $this->currentStep = tenant()->setup_step->value + 1;
  25.  
  26.         // Initialize the saved data
  27.         $this->initializeParameterValues();
  28.     }
  29.  
  30.  
  31.     /**
  32.      * Get the view / contents that represent the component.
  33.      *
  34.      * @return View|string
  35.      */
  36.     public function render(): string|View
  37.     {
  38.         return view('basic::livewire.setup.stepper');
  39.     }
  40.  
  41.     private function initializeParameterValues()
  42.     {
  43.         // Get the step data from the db
  44.         $stepValues = ParameterHelper::getValue(BasicParameter::SETUP_STEP_DATA, []);
  45.  
  46.         // Step 2
  47.         $this->name = $stepValues['name'] ?? tenant()->name;
  48.         $this->language = $stepValues['language'] ?? 'en';
  49.     }
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement