NotificationController.php 782 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use Auth;
  5. class NotificationController extends Controller
  6. {
  7. public function index() {
  8. $notifications = auth()->user()->notifications()->paginate(15);
  9. auth()->user()->unreadNotifications->markAsRead();
  10. if(Auth::user()->user_type == 'admin') {
  11. return view('backend.notification.index', compact('notifications'));
  12. }
  13. if(Auth::user()->user_type == 'seller') {
  14. return view('seller.notification.index', compact('notifications'));
  15. }
  16. if(Auth::user()->user_type == 'customer') {
  17. return view('frontend.user.customer.notification.index', compact('notifications'));
  18. }
  19. }
  20. }