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.

22 lines
541 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()->where('business_id', $business)->get();
  10. }
  11. public function markAsRead($business, $notification)
  12. {
  13. return Auth::user()->unreadNotifications()
  14. ->where('business_id', $business)
  15. ->findOrFail($notification)
  16. ->markAsRead();
  17. }
  18. }