NotificationController.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Contracts\View\Factory;
  4. use Illuminate\Contracts\View\View;
  5. use Illuminate\Http\Request;
  6. use Illuminate\Http\Response;
  7. use Illuminate\Notifications\Notification;
  8. use Illuminate\Support\Facades\Auth;
  9. class NotificationController extends Controller
  10. {
  11. /**
  12. * Display a listing of the resource.
  13. *
  14. * @return Factory|View
  15. */
  16. public function index()
  17. {
  18. $notifications = Auth::user()->notifications()->paginate();
  19. return view('notifications.index')->with([
  20. 'notifications' => $notifications
  21. ]);
  22. }
  23. /**
  24. * Show the form for creating a new resource.
  25. *
  26. * @return Response
  27. */
  28. public function create()
  29. {
  30. //
  31. }
  32. /**
  33. * Store a newly created resource in storage.
  34. *
  35. * @param Request $request
  36. * @return Response
  37. */
  38. public function store(Request $request)
  39. {
  40. //
  41. }
  42. /**
  43. * Display the specified resource.
  44. *
  45. * @param string $id
  46. * @return Factory|View
  47. */
  48. public function show($id)
  49. {
  50. $notification = Auth::user()->notifications()->findOrFail($id);
  51. $notification->markAsRead();
  52. return view('notifications.show')->with([
  53. 'notification' => $notification
  54. ]);
  55. }
  56. /**
  57. * Show the form for editing the specified resource.
  58. *
  59. * @param int $id
  60. * @return Response
  61. */
  62. public function edit($id)
  63. {
  64. //
  65. }
  66. /**
  67. * Update the specified resource in storage.
  68. *
  69. * @param Request $request
  70. * @param int $id
  71. * @return Response
  72. */
  73. public function update(Request $request, $id)
  74. {
  75. //
  76. }
  77. /**
  78. * Remove the specified resource from storage.
  79. *
  80. * @param int $id
  81. * @return Response
  82. */
  83. public function destroy($id)
  84. {
  85. //
  86. }
  87. }