Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
83.33% |
5 / 6 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| AlertsController | |
83.33% |
5 / 6 |
|
50.00% |
1 / 2 |
3.04 | |
0.00% |
0 / 1 |
| index | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| markRead | |
75.00% |
3 / 4 |
|
0.00% |
0 / 1 |
2.06 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Controllers; |
| 4 | |
| 5 | class AlertsController extends BaseController |
| 6 | { |
| 7 | public function index(): string |
| 8 | { |
| 9 | $data = service('alerts')->getIndexData($this->request->getGet(), auth()->user()); |
| 10 | |
| 11 | return view('alerts/index', $data); |
| 12 | } |
| 13 | |
| 14 | public function markRead(int $notificationId) |
| 15 | { |
| 16 | $marked = service('alerts')->markNotificationRead($notificationId, auth()->user()); |
| 17 | |
| 18 | if (! $marked) { |
| 19 | return $this->forbidden('Nu poti modifica aceasta notificare.'); |
| 20 | } |
| 21 | |
| 22 | return redirect()->to(url_to('alerts.index'))->with('message', 'Notificarea a fost marcata ca citita.'); |
| 23 | } |
| 24 | } |