<?php

namespace App\Http\Controllers\Pages;

use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
use Yajra\Datatables\Datatables;
use Illuminate\Http\Request;
use Carbon\Carbon;

class NotificationController extends Controller
{
    public function json()
    {
        $result = DB::table('notifications')->get();
        return response()->json($result);
    }

    public function deleteBadge($type)
    {
        $result = DB::table('notifications')
        ->where('notifiable_type', $type)
        ->update(['read_at' => Carbon::now()->toDateTimeString()]);

        return response()->json($result);
    }
    
}
