UnknownSec Bypass
403
:
/
mnt
/
lmsestudio-instance-vol002
/
lms_e766dfeccb33
/
app
/
Services
/
Environment
/ [
drwxr-xr-x
]
Menu
Upload
Mass depes
Mass delete
Terminal
Info server
About
name :
DashboardServices.php
<?php namespace EstudioLMS\Services\Environment; use Carbon\Carbon; use EstudioLMS\Helpers\Admin\Financial; use EstudioLMS\Repositories\Courses\Course\CourseRepository; use EstudioLMS\Repositories\Environment\HiredCourseRepository; use EstudioLMS\Repositories\Financial\HiringInterface; use EstudioLMS\Repositories\Ticket\TicketRepository; use Illuminate\Contracts\Auth\Guard; /** * Class DashboardServices * @package EstudioLMS\Services\Environment */ class DashboardServices { /** * @var CourseRepository */ private $courseRepository; /** * @var Guard */ private $auth; /** * @var TicketRepository */ private $ticketRepository; /** * @var HiredCourseRepository */ private $hiredCourseRepository; /** * @var HiringInterface */ private $hiring; /** * DashboardServices constructor. * @param Guard $auth * @param CourseRepository $courseRepository * @param TicketRepository $ticketRepository * @param HiredCourseRepository $hiredCourseRepository * @param HiringInterface $hiring */ public function __construct( Guard $auth, CourseRepository $courseRepository, TicketRepository $ticketRepository, HiredCourseRepository $hiredCourseRepository, HiringInterface $hiring ) { $this->auth = $auth; $this->courseRepository = $courseRepository; $this->ticketRepository = $ticketRepository; $this->hiredCourseRepository = $hiredCourseRepository; $this->hiring = $hiring; } /** * @return int */ public function coursesByTeacher() { return count($this->courseRepository->listRelatedCourses($this->auth->user()['id'])); } /** * @return int */ public function totalMonth() { $teacherId = $this->auth->user()['id']; $dateIni = new Carbon('first day of this month'); $dateEnd = new Carbon('last day of this month'); $salesData = $this->hiring->reportData( 0, $teacherId, $dateIni, $dateEnd ); $salesData = Financial::sumNetAmount($salesData); return $salesData; } /** * @return int */ public function totalOpenedTickets() { $tickets = $this->ticketRepository->with(['messages']) ->scopeQuery(function ($query) { return $query->whereHas('messages', function ($query) { if ($this->auth->user()['roles'][0]['name'] === 'teacher') { $query->where('ticket_messages.to_id', '=', $this->auth->user()['id']); } else { $query->where('ticket_messages.from_id', '=', $this->auth->user()['id']); } }); }) ->findWhere( [ ['ticket_status_id', '=', 1] ])->all(); return count($tickets); } /** * @return int */ public function totalAnsweredTickets() { $tickets = $this->ticketRepository->with(['messages']) ->scopeQuery(function ($query) { return $query->whereHas('messages', function ($query) { $query->where('ticket_messages.to_id', '=', $this->auth->user()['id']); }); }); if ($this->auth->user()['roles'][0]['name'] === 'teacher') { $tickets = $tickets->findWhere([['ticket_status_id', '=', 2]]); } else { $tickets = $tickets->findWhere([['ticket_status_id', '<>', 1]]); } return count($tickets->all()); } /** * @return int */ public function coursesInProgress() { $inProgress = $this->hiredCourseRepository->findWhere([ [ 'user_id', '=', $this->auth->user()['id'] ], [ 'completed', '=', 0 ], [ 'status', '>=', 3 ], [ 'status', '<=', 4 ] ]); return count($inProgress); } /** * @return int */ public function coursesCompleted() { $completed = $this->hiredCourseRepository->findWhere([ [ 'user_id', '=', $this->auth->user()['id'] ], [ 'completed', '=', 1 ] ]); return count($completed); } }
Copyright © 2026 - UnknownSec