-
Notifications
You must be signed in to change notification settings - Fork 2
/
ReleaseFinalProgramme.php
52 lines (44 loc) · 1.4 KB
/
ReleaseFinalProgramme.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
<?php
namespace App\Http\Livewire;
use App\Events\FinalProgrammeReleased;
use App\Models\Presentation;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Foundation\Application as ApplicationContract;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Redirector;
use Livewire\Component;
class ReleaseFinalProgramme extends Component
{
public $isOpen = false;
public $numberOfUnscheduledPresentations;
/**
* Triggered on initializing the component
* @return void
*/
public function mount()
{
$this->numberOfUnscheduledPresentations = Presentation::all()->filter(function ($presentation) {
return !$presentation->isScheduled && $presentation->isApproved;
})->count();
}
/**
* Dispatches an event when the final programme is released
* @return Application|\Illuminate\Foundation\Application|RedirectResponse|Redirector
*/
public function confirm()
{
FinalProgrammeReleased::dispatch();
// I am a little baffled at this
return redirect(request()->header('Referer'));
}
/**
* Render the component
* @return Factory|\Illuminate\Foundation\Application|View|ApplicationContract
*/
public function render()
{
return view('livewire.release-final-programme');
}
}