-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathEditFrequentQuestionModal.php
58 lines (49 loc) · 1.26 KB
/
EditFrequentQuestionModal.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
<?php
namespace App\Livewire\FrequentQuestions;
use App\Livewire\Forms\FrequentQuestionForm;
use App\Models\FrequentQuestion;
use Illuminate\View\View;
use Livewire\Component;
use LivewireUI\Modal\ModalComponent;
class EditFrequentQuestionModal extends ModalComponent
{
public FrequentQuestion $faq;
public FrequentQuestionForm $form;
/**
* Initializes the component
* @param FrequentQuestion $faq
* @return void
*/
public function mount(FrequentQuestion $faq)
{
$this->faq = $faq;
$this->form->setFrequentQuestion($faq);
}
/**
* Saves the updates made on the form
*/
public function save()
{
$this->validate();
$this->form->update();
return redirect(route('moderator.faqs.show', $this->faq))
->with('status', 'FAQ successfully updated.');
}
/**
* Sets the maximum width of the modal according to docs:
* https://github.com/wire-elements/modal
* @return string
*/
public static function modalMaxWidth(): string
{
return '5xl';
}
/**
* Renders the component
* @return View
*/
public function render()
{
return view('livewire.frequent-questions.edit-frequent-question-modal');
}
}