UnknownSec Bypass
403
:
/
mnt
/
lmsestudio-instance-vol002
/
lms_aea410fc83cd
/
app
/
Repositories
/
Financial
/ [
drwxr-xr-x
]
Menu
Upload
Mass depes
Mass delete
Terminal
Info server
About
name :
HiringRepository.php
<?php namespace EstudioLMS\Repositories\Financial; use Carbon\Carbon; use EstudioLMS\Models\Financial\Hiring; use Prettus\Repository\Eloquent\BaseRepository; /** * Class HiringRepository * @package EstudioLMS\Repositories\Financial */ class HiringRepository extends BaseRepository implements HiringInterface { /** * Specify Model class name * * @return string */ public function model() { return Hiring::class; } /** * @return mixed */ public function allData() { return $this->model ->join('users', 'hirings.user_id', '=', 'users.id') ->join('courses', 'hirings.course_id', '=', 'courses.id') ->select(['hirings.id', 'hirings.created_at', 'users.email', 'hirings.payment_code', \DB::raw("(GROUP_CONCAT(courses.name)) as `courses_name`"), 'hirings.status', 'hirings.gross_amount', 'hirings.net_amount', 'hirings.shipping_amount', 'hirings.discount_amount', 'hirings.shipping_type', 'hirings.gateway_id', 'hirings.payment_method' ]) ->groupBy('hirings.id') ->orderBy('hirings.created_at', 'DESC') ->get(); } /** * @param $month * @param int $year * @param array $status * @return mixed * @throws \Exception */ public function sumMonth($month, $year = 0, $status = []) { if($year == 0) { $year = date('Y'); } $baseDate = new \DateTime($year.'-'.$month.'-1 00:00:00'); $startDate = $baseDate->modify('first day of this month')->format('Y-m-d 23:59:59'); $finalDate = $baseDate->modify('last day of this month')->format('Y-m-d 23:59:59'); $summary = $this->model ->select(\DB::raw('SUM(net_amount) AS total_month')) ->where('updated_at', '>=', $startDate) ->where('updated_at', '<=', $finalDate); if(count($status) > 0) { $summary->whereIn('status', $status); } $summary = $summary->first(); return $summary['total_month']; } /** * @param int $courseId * @param int $teacherId * @param int $dateIni * @param int $dateEnd * @return mixed */ public function reportData($courseId = 0, $teacherId = 0, $dateIni = 0, $dateEnd = 0) { $stmt = \DB::table('hirings AS hh'); $stmt = $stmt->join('courses AS c', 'hh.course_id', '=', 'c.id'); $stmt = $stmt->join('users AS u', 'c.user_id', '=', 'u.id'); $stmt =$stmt->select([ 'hh.created_at', 'hh.status','hh.gross_amount', 'hh.fee_amount', 'hh.discount_amount', 'hh.net_amount', 'hh.shipping_amount', 'hh.gateway_id', 'c.name as course', 'u.name' ]); if ($courseId > 0) $stmt = $stmt->where('c.id', '=', $courseId); if ($teacherId > 0) $stmt = $stmt->where('u.id', '=', $teacherId); if (!empty($dateIni)) $stmt = $stmt->where('hh.created_at', '>=', $dateIni); if (!empty($dateEnd)) $stmt = $stmt->where('hh.created_at', '<=', $dateEnd); $stmt = $stmt->get(); return $stmt; } /** * @param $userId * @return mixed */ public function ordersList($userId) { return $this->model ->with(['user', 'course']) ->where('user_id', '=', $userId) ->get(); } /** * Find data by multiple fields * * @param array $where * @return mixed */ public function where(array $where) { $this->applyCriteria(); $this->applyScope(); foreach ($where as $field => $value) { if ( is_array($value) ) { list($field, $condition, $val) = $value; $this->model = $this->model->where($field,$condition,$val); } else { $this->model = $this->model->where($field,'=',$value); } } return $this; } /** * @param $userId * @return array|\Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model[] */ public function hiredCourses($userId) { return $this->model ->with(['course']) ->where('user_id', '=', $userId) ->whereIn('status', [1, 2, 3, 4, 10]) ->get(); } /** * @param $userId * @param $courseId * @return mixed */ public function getCourseDetailsById($userId, $courseId) { return $this->model ->with([ 'course', 'course.category', 'course.user', 'course.level', 'course.modules' => function($query) { $query->whereRaw('((modules.published_at <= now() OR modules.published_at is null) and ((modules.unpublished_at >= now() OR modules.unpublished_at is null)))') ->where('modules.published', '=', 1); }, 'course.modules.lessons' ]) ->where('user_id', '=', $userId) ->CourseId($courseId) ->first(); } /** * @inheritDoc */ public function setCompleted($userId, $courseId) { return $this->model ->whereHas('course', function($query) { $query->where('course_status_id', '<>', 2); }) ->where('user_id', '=', $userId) ->where('course_id', '=', $courseId) ->where('completed', '=', false) ->update([ 'completed' => true, 'completed_at' => Carbon::now() ]); } }
Copyright © 2026 - UnknownSec