-
Notifications
You must be signed in to change notification settings - Fork 2
/
EditBoothModal.php
57 lines (48 loc) · 1.13 KB
/
EditBoothModal.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
<?php
namespace App\Livewire\Booth;
use App\Livewire\Forms\BoothForm;
use App\Models\Booth;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
use LivewireUI\Modal\ModalComponent;
class EditBoothModal extends ModalComponent
{
public Booth $booth;
public BoothForm $form;
/**
* Initializes the component
* @param Booth $booth
* @return void
*/
public function mount(Booth $booth)
{
$this->booth = $booth;
$this->form->setBooth($booth);
}
/**
* Saves the updates made on the form
*/
public function save()
{
$this->validate();
$this->form->update();
return redirect(route('moderator.booths.show', $this->booth))
->with('status', 'Booth successfully updated.');
}
/**
* Sets the maximum width of the modal according to docs
* @return string
*/
public static function modalMaxWidth(): string
{
return '3xl';
}
/**
* Renders the component
* @return View
*/
public function render() : View
{
return view('livewire.booth.edit-booth-modal');
}
}