-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEditRoomModal.php
59 lines (50 loc) · 1.16 KB
/
EditRoomModal.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
<?php
namespace App\Livewire\Room;
use App\Livewire\Forms\BoothForm;
use App\Livewire\Forms\RoomForm;
use App\Models\Booth;
use App\Models\Room;
use Illuminate\View\View;
use Livewire\Component;
use LivewireUI\Modal\ModalComponent;
class EditRoomModal extends ModalComponent
{
public Room $room;
public RoomForm $form;
/**
* Initializes the component
* @param Room $room
* @return void
*/
public function mount(Room $room)
{
$this->room = $room;
$this->form->setRoom($room);
}
/**
* Saves the updates made on the form
*/
public function save()
{
$this->validate();
$this->form->update();
return redirect(route('moderator.rooms.show', $this->room))
->with('status', 'Rooms 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.room.edit-room-modal');
}
}