@extends('partials.main') @section('title') Community Request @endsection @section('content') @php $login_user = auth()->user(); $now = Carbon\Carbon::now(); $daily= $now->startOfmonth()->format('Y-m-d H:i'); $weekStartWeek= $now->startOfWeek()->format('Y-m-d H:i'); $weekEndWeek = $now->endOfWeek()->format('Y-m-d H:i'); $startmonth= $now->startOfmonth()->format('Y-m-d H:i'); $endmonth = $now->endOfmonth()->format('Y-m-d H:i'); $form_campaign = App\Models\Form_Campaign::query(); $formslist = Form::get(); if($login_user->roles[0]->name == 'Client') { $today= $form_campaign->where('client_id',$login_user->id)->whereDate('created_at', '>=', $daily) ->count(); $weekly= $form_campaign->where('client_id',$login_user->id)->whereDate('created_at', '>=', $weekStartWeek) ->whereDate('created_at', '<=', $weekEndWeek)->count(); $monthly= $form_campaign->where('client_id',$login_user->id)->whereDate('created_at', '>=', $startmonth) ->whereDate('created_at', '<=', $endmonth)->count(); $open = $form_campaign->where('client_id',$login_user->id)->where('status','1')->count(); $pending = $form_campaign->where('client_id',$login_user->id)->where('status','0')->count(); $complete = $form_campaign->where('client_id',$login_user->id)->where('status','2')->count(); } else { $today= $form_campaign->whereDate('created_at', '>=', $daily) ->count(); $weekly= $form_campaign->whereDate('created_at', '>=', $weekStartWeek) ->whereDate('created_at', '<=', $weekEndWeek)->count(); $monthly= $form_campaign->whereDate('created_at', '>=', $startmonth) ->whereDate('created_at', '<=', $endmonth)->count(); $open = $form_campaign->where('status','1')->count(); $pending = $form_campaign->where('status','0')->count(); $complete = $form_campaign->where('status','2')->count(); } @endphp