diff --git a/src/Http/Livewire/User/FillForms.php b/src/Http/Livewire/User/FillForms.php index 57b6dc45..f5cf59c0 100644 --- a/src/Http/Livewire/User/FillForms.php +++ b/src/Http/Livewire/User/FillForms.php @@ -16,14 +16,14 @@ class FillForms extends Component implements Forms\Contracts\HasForms public Form $zeusForm; public $zeusData = []; - protected function getFormSchema() : array + protected function getFormSchema(): array { $sections = []; foreach ($this->zeusForm->sections as $section) { $fields = []; foreach ($section->fields as $field) { - $class = '\Filament\Forms\Components\\' . $field->type; - $setField = $class::make('zeusData.' . $field->id) + $class = '\Filament\Forms\Components\\'.$field->type; + $setField = $class::make('zeusData.'.$field->id) ->label($field->name) ->helperText($field->description) ->id($field->html_id) @@ -31,9 +31,9 @@ protected function getFormSchema() : array if ($field->type === 'Select') { $setField = $setField->options(collect(Collection::find($field->options['dataSource'])->values)->pluck('itemValue', 'itemKey')->toArray()); - }; + } - $fields[] = Forms\Components\Card::make()->schema([ $setField ]); + $fields[] = Forms\Components\Card::make()->schema([$setField]); } $sections[] = Forms\Components\Section::make($section->name)->schema($fields); } @@ -41,14 +41,14 @@ protected function getFormSchema() : array return $sections; } - protected function getFormModel() : Form + protected function getFormModel(): Form { return $this->zeusForm; } public function mount($slug) { - $this->zeusForm = Form::with([ 'sections', 'fields' ])->whereSlug($slug)->firstOrFail(); + $this->zeusForm = Form::with(['sections', 'fields'])->whereSlug($slug)->firstOrFail(); foreach ($this->zeusForm->fields as $field) { $this->zeusData[$field->id] = ''; @@ -91,21 +91,21 @@ public function store() $this->validate(); $response = Response::make([ 'form_id' => $this->zeusForm->id, - 'user_id' => ( auth()->check() ) ? auth()->user()->id : 0, + 'user_id' => (auth()->check()) ? auth()->user()->id : 0, 'status' => 'NEW', 'notes' => '', ]); $response->save(); foreach ($this->form->getState()['zeusData'] as $field => $value) { - $fieldResponse['response'] = $value ?? ''; + $fieldResponse['response'] = $value ?? ''; $fieldResponse['response_id'] = $response->id; - $fieldResponse['form_id'] = $this->zeusForm->id; - $fieldResponse['field_id'] = $field; + $fieldResponse['form_id'] = $this->zeusForm->id; + $fieldResponse['field_id'] = $field; FieldResponse::create($fieldResponse); } - return redirect()->route('bolt.user.submitted', [ 'slug' => $this->zeusForm->slug ]); + return redirect()->route('bolt.user.submitted', ['slug' => $this->zeusForm->slug]); } public function render()