1
|
|
|
<?php namespace WITR\Http\Controllers; |
2
|
|
|
|
3
|
|
|
use WITR\Http\Requests; |
4
|
|
|
use WITR\Http\Requests\DJ\TicketRequest; |
5
|
|
|
use WITR\Http\Controllers\Controller; |
6
|
|
|
use WITR\Services\IcecastReader; |
7
|
|
|
use WITR\TopTwenty\Reader as WeeklyChart; |
8
|
|
|
use Illuminate\Contracts\Filesystem\Factory as Storage; |
9
|
|
|
use Illuminate\Contracts\Mail\Mailer; |
10
|
|
|
use WITR\SystemSetting; |
11
|
|
|
|
12
|
|
|
use Illuminate\Http\Request; |
13
|
|
|
|
14
|
|
|
class DJController extends Controller { |
15
|
|
|
|
16
|
|
|
public function __construct() |
17
|
|
|
{ |
18
|
|
|
$this->middleware('dj'); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
public function index() |
22
|
|
|
{ |
23
|
|
|
$workHoursForm = SystemSetting::djHoursFormLocation()->value; |
|
|
|
|
24
|
|
|
$cdSignoutForm = SystemSetting::cdSignoutFormLocation()->value; |
|
|
|
|
25
|
|
|
return view('dj.index', compact('workHoursForm', 'cdSignoutForm')); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
public function listeners(IcecastReader $icecast, $studio = 'studio-x') |
29
|
|
|
{ |
30
|
|
|
$listeners = $icecast->get($studio); |
31
|
|
|
return view('dj.listeners', compact('listeners', 'studio')); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function fetchFile(Storage $storage, $file) |
35
|
|
|
{ |
36
|
|
|
if (!$storage->exists($file)) |
|
|
|
|
37
|
|
|
{ |
38
|
|
|
return abort(404); |
39
|
|
|
} |
40
|
|
|
$locationRoot = $storage->getDriver()->getAdapter()->getPathPrefix(); |
|
|
|
|
41
|
|
|
return response()->download($locationRoot . $file); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function ticketForm() |
45
|
|
|
{ |
46
|
|
|
return view('dj.ticket'); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
View Code Duplication |
public function submitTicket(Mailer $mailer, TicketRequest $request) |
|
|
|
|
50
|
|
|
{ |
51
|
|
|
$ticketRecipient = app('config')['witr.ticket_recipient']; |
52
|
|
|
$mailer->send('emails.support_ticket', $request->all(), function($message) use ($ticketRecipient) |
53
|
|
|
{ |
54
|
|
|
$message->to($ticketRecipient['email'], $ticketRecipient['name']) |
55
|
|
|
->subject('WITR Support Ticket'); |
56
|
|
|
}); |
57
|
|
|
|
58
|
|
|
return redirect()->route('dj.index') |
59
|
|
|
->with('success', 'Support Ticket Submitted!'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function topWeek(WeeklyChart $chart) |
63
|
|
|
{ |
64
|
|
|
$tracks = $chart->getWeek(); |
65
|
|
|
return view('dj.chart', compact('tracks')); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.