@php use App\Models\Attendance; use Carbon\Carbon; use App\Models\User; use App\Models\ChMessage; use App\Models\Order; use App\Models\Product; use App\Models\Project; use App\Models\Ticket; use App\Models\Task; $admin = auth()->guard('web')->id(); $today = Carbon::today(); $attendance = Attendance::where('user_id', $admin)->whereDate('presence', $today)->whereNull('absence')->first(); //fetch all of the notifications for SuperAdmin $unreadNotifications = Task::where('is_read',0)->get()->count() + Order::where('is_read',0)->get()->count() + Product::where('is_read',0)->get()->count() + Ticket::where('is_read',0)->get()->count() + Project::where('is_read',0)->get()->count() + ChMessage::where('is_read',0)->where('to_id',$admin)->get()->count(); // fetch only messages count for regural users $unreadMessages = ChMessage::where('is_read',0)->where('to_id',$admin)->get()->count(); // fetch all of the unreaded message for the current authenticated and with specifc order. $MessageSender = ChMessage::Where('to_id',$admin)->where('is_read',0)->orderBy('created_at','DESC')->get(); //unreaded orders $order = Order::where('is_read',0)->orderBy('created_at','DESC')->get(); //dd($order); //unreaded Product $product = Product::where('is_read',0)->orderBy('created_at','DESC')->get(); //unreaded Project //fetch the required data from the customers $project = Project::where('is_read',0)->orderBy('created_at','DESC')->get(); // dd($project); //fetch the required data from the company ///unreaded task $task = Task::where('is_read',0)->orderBy('created_at','DESC')->get(); //unreaded Ticket $ticket = Ticket::where('is_read',0)->get(); @endphp @include('backend.dashboard.Attendence.attendance-partial')