-
Notifications
You must be signed in to change notification settings - Fork 2
/
ParticipantController.php
54 lines (45 loc) · 1.29 KB
/
ParticipantController.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
<?php
namespace App\Http\Controllers\Hub;
use App\Http\Controllers\Controller;
use App\Models\Feedback;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
class ParticipantController extends Controller
{
/**
* Displays the view of the personal programme for the participant
*
* @return View
*/
public function programme(): View
{
$presentations = Auth::user()->participating_in->sortBy('start');
return view('myhub.programme', compact('presentations'));
}
/**
* Show the form for creating a new resource.
*/
public function createFeedback()
{
if (Auth::user()->cannot('create', Feedback::class)) {
abort(403);
}
return view('myhub.feedback');
}
/**
* Store a newly created resource in storage.
*/
public function storeFeedback(Request $request)
{
if (Auth::user()->cannot('create', Feedback::class)) {
abort(403);
}
$validated = $request->validate(Feedback::$rules);
Feedback::create(array_merge(
$validated,
['reported_by_id' => Auth::user()->id]
));
return redirect(route('dashboard'))->banner('You successfully submitted your feedback!');
}
}