/
home
/
maktab
/
server
/
app
/
Http
/
Controllers
/
Admin
/
File Upload :
llllll
Current File: /home/maktab/server/app/Http/Controllers/Admin/DashboardController.php
<?php namespace App\Http\Controllers\Admin; use App\Http\Controllers\Controller; use App\Models\Attendance; use App\Models\Cloony; use App\Models\Cnt; use App\Models\Maktab; use App\Models\User; use Illuminate\Http\Request; class DashboardController extends Controller { public function dashboard(){ $v = verta(); $v->startWeek(); $start = $v->startWeek()->toCarbon(); $end = $v->endWeek()->toCarbon(); $maktab = Maktab::count(); $const = Cnt::where('key','type_employee')->where('value','مربی')->first(); $count_teacher_active = User::where('type_employee',$const->id)->where('active',1)->count(); $count_teacher_deactive = User::where('type_employee',$const->id)->where('active',false)->count(); $count_teacher = User::where('type_employee',$const->id)->count(); $count_cloony = Cloony::count(); $present_week = Attendance::where('present',1) ->whereDate('date_at','>=',$start) ->whereDate('date_at','<=',$end) ->count(); $present_month = Attendance::where('present',1) ->whereDate('date_at','>=',now()->subDays(30)) ->whereDate('date_at','<=',now()) ->count(); $present_3month = Attendance::where('present',1) ->whereDate('date_at','>=',now()->subMonth(3)) ->whereDate('date_at','<=',now()) ->count(); return response()->json([ 'count_maktab'=>$maktab, 'count_teacher_active'=>$count_teacher_active, 'count_teacher'=>$count_teacher, 'count_present_week'=>$present_week, 'count_present_month'=>$present_month, 'count_present_3month'=>$present_3month, 'count_cloony'=>$count_cloony, 'count_teacher_deactive'=>$count_teacher_deactive ]); } }
Copyright ©2k19 -
Hexid
|
Tex7ure