-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJoinAsSpeakerModal.php
47 lines (39 loc) · 1.04 KB
/
JoinAsSpeakerModal.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
<?php
namespace App\Livewire\Presentation;
use App\Models\Presentation;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
use LivewireUI\Modal\ModalComponent;
class JoinAsSpeakerModal extends ModalComponent
{
public Presentation $presentation;
/**
* Initializes the component
*
* @param Presentation $presentation
* @return void
*/
public function mount(Presentation $presentation)
{
$this->presentation = $presentation;
}
/**
* Saves the updates made on the form
*/
public function save()
{
$this->authorize('joinAsCospeaker', $this->presentation);
Auth::user()->joinPresentation($this->presentation, 'speaker');
return redirect(route('presentations.show', $this->presentation))
->with('status', 'Presentation successfully updated.');
}
/**
* Renders the component
*
* @return View
*/
public function render(): View
{
return view('livewire.presentation.join-as-speaker-modal');
}
}