Skip to content

Commit 60fad39

Browse files
jyrkidngithub-actions[bot]
authored andcommitted
Fix styling
1 parent 4d787e6 commit 60fad39

14 files changed

Lines changed: 61 additions & 49 deletions

config/livewire-forms.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@
2323
'buttonClass' => 'btn btn--primary',
2424
'buttonIcon' => null,
2525
'textareaRows' => 5,
26-
]
26+
],
2727
];

src/Fields/CurrencyField.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
class CurrencyField extends TextField
88
{
99
public $symbol = '';
10+
1011
public $symbolAfter = '';
1112

1213
public function getValue($doConditionalChecks = false)
@@ -18,11 +19,11 @@ public function getValue($doConditionalChecks = false)
1819
}
1920

2021
if (! Str::startsWith($value, $this->symbol)) {
21-
$value = $this->symbol . $value;
22+
$value = $this->symbol.$value;
2223
}
2324

2425
if (! Str::endsWith($value, $this->symbolAfter)) {
25-
$value = $value . $this->symbolAfter;
26+
$value = $value.$this->symbolAfter;
2627
}
2728

2829
return $value;

src/Fields/DateField.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
class DateField extends Field
66
{
77
public $component = 'livewire-forms::fields.date';
8+
89
public $debounce = 'debounce.1500ms';
910
}

src/Fields/Field.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function getName($usePrefixes = true)
6464
}
6565

6666
if ($usePrefixes && $this->groupPrefixes !== []) {
67-
return implode('.', $this->groupPrefixes) . '.' . $name;
67+
return implode('.', $this->groupPrefixes).'.'.$name;
6868
}
6969

7070
return $name;
@@ -76,7 +76,7 @@ public function getId()
7676
return $this->fieldId;
7777
}
7878

79-
return $this->fieldId = Str::slug($this->getName() . '-' . Str::random(8));
79+
return $this->fieldId = Str::slug($this->getName().'-'.Str::random(8));
8080
}
8181

8282
public function getValue($doConditionalChecks = false)

src/Fields/Link.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public function isJson($value)
3434
{
3535
json_decode($value);
3636

37-
return (json_last_error() == JSON_ERROR_NONE);
37+
return json_last_error() == JSON_ERROR_NONE;
3838
}
3939
}

src/Form.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
abstract class Form
88
{
99
public $fields = null;
10+
1011
public $binding = 'livewire';
1112

1213
abstract public function fields();
@@ -19,8 +20,9 @@ public function __construct()
1920

2021
/**
2122
* Return only the fields and nested fields (without Row, Group, ...)
22-
* @param bool $doConditionalChecks Return all the fields, or filter them on conditionals
23-
* @param array $stack Return the fieldStack of a stack of fields
23+
*
24+
* @param bool $doConditionalChecks Return all the fields, or filter them on conditionals
25+
* @param array $stack Return the fieldStack of a stack of fields
2426
*/
2527
public function fieldStack($doConditionalChecks = false, $stack = null): array
2628
{
@@ -69,8 +71,8 @@ public function validation($stack = null, $skipChecks = false): array
6971
$fields->each(function (Field $value) use (&$rules, &$messages, $skipChecks) {
7072
if ($skipChecks || $value->conditionalCheck()) {
7173
$target = ($value->containsFile ? 'files' : 'fields');
72-
$rules->put($target . '.' . $value->getName(), $value->rules ?? '');
73-
$messages->put($target . '.' . $value->getName(), $value->validationMessages ?? '');
74+
$rules->put($target.'.'.$value->getName(), $value->rules ?? '');
75+
$messages->put($target.'.'.$value->getName(), $value->validationMessages ?? '');
7476
}
7577
});
7678

src/FormController.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace Wotz\LivewireForms;
44

5-
use Wotz\LivewireForms\Fields\Field;
65
use Exception;
76
use Illuminate\Support\Arr;
87
use Illuminate\Support\Facades\View;
98
use Livewire\Component;
109
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
1110
use Livewire\WithFileUploads;
11+
use Wotz\LivewireForms\Fields\Field;
1212

1313
class FormController extends Component
1414
{
@@ -18,17 +18,25 @@ class FormController extends Component
1818
use WithFileUploads;
1919

2020
public string $formClass;
21+
2122
public string $modelClass;
2223

23-
public null | string $locale = null;
24-
public null | string $component;
24+
public ?string $locale = null;
25+
26+
public ?string $component;
27+
2528
public array $fields = [];
29+
2630
public array $validation = [];
31+
2732
public array $syncs = [];
33+
2834
public array $flashes = [];
2935

3036
protected array $messages = [];
31-
protected null | Form $form = null;
37+
38+
protected ?Form $form = null;
39+
3240
protected array $fieldStack = [];
3341

3442
public function hydrate()
@@ -107,7 +115,7 @@ public function setValidation()
107115

108116
public function getForm()
109117
{
110-
return (new $this->formClass);
118+
return new $this->formClass;
111119
}
112120

113121
public function flash($name, $message)

src/LivewireFormsServiceProvider.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function boot()
1010
{
1111
$this->loadViews();
1212
$this->mergeConfigFrom(
13-
__DIR__ . '/../config/livewire-forms.php',
13+
__DIR__.'/../config/livewire-forms.php',
1414
'livewire-forms'
1515
);
1616

@@ -19,18 +19,18 @@ public function boot()
1919

2020
public function loadViews()
2121
{
22-
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'livewire-forms');
22+
$this->loadViewsFrom(__DIR__.'/../resources/views', 'livewire-forms');
2323
}
2424

2525
public function publishData()
2626
{
2727
$this->publishes(
28-
[__DIR__ . '/../resources/views' => resource_path('views/vendor/livewire-forms')],
28+
[__DIR__.'/../resources/views' => resource_path('views/vendor/livewire-forms')],
2929
'laravel-livewire-forms-views'
3030
);
3131

3232
$this->publishes([
33-
__DIR__ . '/../config/livewire-forms.php' => config_path('livewire-forms.php'),
33+
__DIR__.'/../config/livewire-forms.php' => config_path('livewire-forms.php'),
3434
], 'laravel-livewire-forms-config');
3535
}
3636

src/Traits/HandleFiles.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ private function uploadFile($field, $file)
4040
return $file->save($field->disk ?? 'public');
4141
} catch (ValidationException $e) {
4242
throw ValidationException::withMessages([
43-
'files.' . $field->getName() => $e->getMessage(),
43+
'files.'.$field->getName() => $e->getMessage(),
4444
]);
4545
}
4646
}

tests/Feature/FormControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
use Wotz\LivewireForms\FormController;
43
use Illuminate\Http\UploadedFile;
54
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
65
use Livewire\Livewire;
@@ -12,6 +11,7 @@
1211
use Tests\Fixtures\TestWithFileStepForm;
1312
use Tests\Fixtures\TestWithFlashForm;
1413
use Tests\Fixtures\TestWithModelForm;
14+
use Wotz\LivewireForms\FormController;
1515

1616
test('form controller throws exception if formClass is not passed', function () {
1717
$this->expectException(Exception::class);

0 commit comments

Comments
 (0)