-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCompanyLocationForm.php
62 lines (51 loc) · 1.54 KB
/
CompanyLocationForm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
namespace App\Livewire\Registration;
use Illuminate\View\View;
use Livewire\Attributes\Validate;
use Livewire\Component;
class CompanyLocationForm extends Component
{
#[Validate('required', 'string', 'min:1', 'max:255')]
public string $companyPostcode;
#[Validate(['required',
'regex:/(\w?[0-9]+[a-zA-Z0-9\- ]*)$/i',
'min:1', 'max:255'])]
public string $companyHouseNumber;
#[Validate(['required', 'string', 'min:3', 'max:255'])]
public string $companyStreet;
#[Validate(['required', 'string', 'min:3', 'max:255'])]
public string $companyCity;
#[Validate(['accepted', 'required'])]
public $terms;
/**
* Dispatches an event to the parent component to go back
* @return void
*/
public function goBack()
{
$this->dispatch('go-back', formName: 'CompanyLocationInfoForm');
}
/**
* Dispatches an event to the parent to go next
* @return void
*/
public function goNext()
{
$this->validate();
$this->dispatch('go-next', formName: 'CompanyLocationInfoForm', input: [
'company_postcode' => $this->companyPostcode,
'company_house_number' => $this->companyHouseNumber,
'company_street' => $this->companyStreet,
'company_city' => $this->companyCity,
'terms' => $this->terms
]);
}
/**
* Renders the component
* @return View
*/
public function render() : View
{
return view('livewire.registration.company-location-form');
}
}