-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEditBoothModal.php
51 lines (41 loc) · 1.26 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
<?php
namespace App\Http\Livewire\Booths;
use App\Models\Booth;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\Factory;
use Illuminate\View\View;
use Livewire\Component;
use Symfony\Component\Console\Application;
class EditBoothModal extends Component
{
public Booth $booth;
/**
* Renders the component
* @return View|Application|Factory|\Illuminate\Contracts\Foundation\Application
*/
public function render()
{
return view('moderator.booths.edit-booth-modal');
}
protected $rules = [
'booth.width' => 'required|min:0|numeric',
'booth.length' => 'required|min:0|numeric',
'booth.additional_information' => ''
];
/**
* Saves the changes made on the booth
* @return RedirectResponse
*/
public function save() : RedirectResponse
{
$this->validate();
if (is_null($this->booth->additional_information)
|| $this->booth->additional_information == '') {
$this->booth->additional_information = 'No additional info';
}
$this->booth->save();
return redirect(route('moderator.booths.show', $this->booth))
->with('status', 'Booth successfully updated.');
}
}