1class ContactForm extends Component
2{
3 public $name;
4 public $email;
5
6 protected $rules = [
7 'name' => 'required|min:6',
8 'email' => 'required|email',
9 ];
10
11 public function updated($propertyName)
12 {
13 $this->validateOnly($propertyName);
14 }
15
16 public function saveContact()
17 {
18 $validatedData = $this->validate();
19
20 Contact::create($validatedData);
21 }
22}