You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
560 B

  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Support\Facades\Auth;
  5. class NotificationController extends Controller
  6. {
  7. public function index($business)
  8. {
  9. return Auth::user()->notifications()
  10. ->where('data->business_id', $business)->get();
  11. }
  12. public function markAsRead($business, $notification)
  13. {
  14. return Auth::user()->unreadNotifications()
  15. ->where('business_id', $business)
  16. ->findOrFail($notification)
  17. ->markAsRead();
  18. }
  19. }