UnknownSec Bypass
403
:
/
mnt
/
lmsestudio-instance-vol002
/
lms_a24da747acc9
/
app
/
Http
/
Controllers
/
Courses
/ [
drwxr-xr-x
]
Menu
Upload
Mass depes
Mass delete
Terminal
Info server
About
name :
CoursesController.php
<?php namespace EstudioLMS\Http\Controllers\Courses; use Cohensive\Embed\Facades\Embed; use EstudioLMS\Base\ResponseBuilder; use EstudioLMS\Helpers\htmlHelper; use EstudioLMS\Http\Controllers\Controller; use EstudioLMS\Models\Environment\HiredCourse; use EstudioLMS\Repositories\Blog\LanguageRepository; use EstudioLMS\Repositories\Config\ConfigRepository; use EstudioLMS\Repositories\Courses\Category\CategoryRepository; use EstudioLMS\Repositories\Courses\Course\CourseRepository; use EstudioLMS\Repositories\Environment\HiredCourseRepository; use EstudioLMS\Repositories\Faq\FaqRepository; use EstudioLMS\Repositories\Financial\PlanRepository; use EstudioLMS\System\PlanValidator; use Illuminate\Auth\Guard; use Illuminate\Http\Request; use mjanssen\BreadcrumbsBundle\Breadcrumbs; use SEO; /** * Class CoursesController * @package EstudioLMS\Http\Controllers\Courses */ class CoursesController extends Controller { /** * @var CourseRepository */ private $courseRepo; /** * @var CategoryRepository */ private $categoryRepo; /** * @var PlanRepository */ private $plan; /** * @var Breadcrumbs */ private $breadCrumb; /** * @var LanguageRepository */ private $languagesRepository; /** * @var ConfigRepository */ private $configRepository; /** * @var FaqRepository */ private $faqRepository; /** * @var Guard */ private $auth; /** * @var HiredCourseRepository */ private $hiredCourse; /** * @var ResponseBuilder */ private $builder; /** * @var PlanValidator */ private $planValidator; /** * @param CourseRepository $courseRepo * @param CategoryRepository $categoryRepo * @param PlanRepository $plan * @param Breadcrumbs $breadCrumb * @param LanguageRepository $languagesRepository * @param ConfigRepository $configRepository * @param FaqRepository $faqRepository * @param Guard $auth * @param HiredCourseRepository $hiredCourse * @param ResponseBuilder $builder * @param PlanValidator $planValidator */ public function __construct( CourseRepository $courseRepo, CategoryRepository $categoryRepo, PlanRepository $plan, Breadcrumbs $breadCrumb, LanguageRepository $languagesRepository, ConfigRepository $configRepository, FaqRepository $faqRepository, Guard $auth, HiredCourseRepository $hiredCourse, ResponseBuilder $builder, PlanValidator $planValidator ) { $this->courseRepo = $courseRepo; $this->categoryRepo = $categoryRepo; $this->plan = $plan; $this->breadCrumb = $breadCrumb; $this->languagesRepository = $languagesRepository; $this->configRepository = $configRepository; $this->faqRepository = $faqRepository; $this->auth = $auth; $this->hiredCourse = $hiredCourse; $this->builder = $builder; $this->planValidator = $planValidator; } /** * @return \Illuminate\View\View */ public function index() { $categ_list = ['' => 'Filtrar pela categoria:'] + $this->categoryRepo->listAvailable(); $showFilters = true; $ngController = ''; $languages = ['' => 'Escolha o Idioma'] + $this->languagesRepository->all() ->lists('name', 'id')->toArray(); $title = 'Todos os Cursos'; $this->breadCrumb->addBreadcrumb('Home', route('index')); $this->breadCrumb->addBreadcrumb('Todos os Cursos', route('courses.list')); $bread = $this->breadCrumb->generate(); return view( 'site.course.courses', compact('categ_list', 'languages', 'showFilters', 'ngController', 'title', 'bread') ); } /** * @return mixed */ public function showCourses() { return $this->courseRepo->showCourseList(); } /** * @param $categSlug * @return \Illuminate\View\View */ public function indexCategory($categSlug) { $category = $this->categoryRepo->findByField('slug', $categSlug)->first(); $title = 'Cursos da Categoria'; $this->breadCrumb->addBreadcrumb('Home', route('index')); $this->breadCrumb->addBreadcrumb('Cursos Online', route('courses.list')); $this->breadCrumb->addBreadcrumb($category['name'], route('courses.list.api.category', $categSlug)); $bread = $this->breadCrumb->generate(); return view('site.course.categories_courses', compact('category', 'title', 'bread')); } /** * @param $categSlug * @return mixed */ public function showCoursesByCategory($categSlug) { return $this->courseRepo->showCoursesListByCategory($categSlug); } /** * @param $slugCourse * @return \Illuminate\View\View */ public function showCourse($slugCourse) { $this->planValidator->customerStats(); $course = $this->courseRepo->getCourseBySlug($slugCourse, true); if (!$course) { abort(404); } if (!$course->published) { return redirect()->route('index'); } $currentDateTime = date('Y-m-d H:i:s'); if (!empty($course->published_at) && ($course->getOriginal('published_at') >= $currentDateTime)) { return redirect()->route('index'); } if (!empty($course->unpublished_at) && ($course->getOriginal('unpublished_at') <= $currentDateTime)) { return redirect()->route('index'); } $hasCourse = false; if ($this->auth->check()) { $userId = $this->auth->user()['id']; $hasCourse = $this->hiredCourse->findWhere( [ ['user_id', '=', $userId], ['course_id', '=', $course['id']], ['status', '<=', 4] ] )->first(); } $instructorCourses = $this->courseRepo->listRelatedCourses($course['user']['id'], [$course['id']]); $embed = Embed::make($course['cover_video'])->parseUrl(); if ($embed) { // Set width of the embed. $embed->setAttribute(['width' => 800]); $embed->setAttribute(['height' => 450]); $course['embed'] = $embed->getHtml(); } $plans = $this->plan->with('duration')->all(); foreach ($plans as $key => $plan) { $value = $course->plans->where('id', (int)$plan->id)->first(); if (count($value) > 0) { $plans[$key]['value'] = $value->pivot->price; $plans[$key]['checked'] = true; $plans[$key]['default'] = $value->pivot->default; if ($value->pivot->default) { $defaultPlan = $plan->id; $defaultValue = $value->pivot->price + ($value->pivot->registration > 0 ? $value->pivot->registration : 0); } } else { unset($plans[$key]); } } $actualDate = date('Y-m-d H:i:s', time()); $studentCount = \DB::table('hired_courses') ->selectRaw('COUNT(*) AS countStudent') ->where('course_id', '=', $course['id']) ->where('end', '>=', $actualDate) ->first(); $courseFaqs = $this->faqRepository->availableFaqs(1); foreach ($courseFaqs as $key => $reg) { $courseFaqs[$key]['type'] = explode(', ', $reg['type']); $courseFaqs[$key]['typeText'] = implode(', ', str_replace([1, 2, 3, 4], ['Cursos', 'Alunos', 'Afiliados', 'Instrutores'], $courseFaqs[$key]['type'])); } $title = $course['name']; $desc = $course['short_description']; SEO::setTitle($title); SEO::setDescription($desc); SEO::opengraph()->setTitle($title); SEO::opengraph()->setDescription($desc); SEO::opengraph()->setUrl(route('courses.categ.course.list', [$course['category']['slug'], $course['slug']])); SEO::opengraph()->addProperty('type', 'course'); SEO::opengraph()->addProperty('locale', 'pt-br'); SEO::opengraph()->addProperty('locale:alternate', ['pt-pt', 'en-us']); SEO::opengraph()->addImage(url('/assets/images/site/logotipo.png')); SEO::twitter()->setSite('@Acadtech'); $ratings = \DB::table('course_ratings') ->select('name', 'email', 'picture', 'rating', 'comments') ->join('users', 'course_ratings.user_id', '=', 'users.id') ->where('course_ratings.course_id', '=', $course['id']) ->orderByRaw("RAND()") ->limit(8) ->get(); $allRatings = \DB::table('course_ratings') ->where('course_ratings.course_id', '=', $course['id']) ->get(); $averageRating = 0; if (count($allRatings) > 0) { $factor = count($allRatings); $ratingVal = 0; foreach ($allRatings as $rating) { $ratingVal += $rating->rating; } $averageRating = $ratingVal / $factor; } return view( 'site.course.landing_page', compact('course', 'instructorCourses', 'plans', 'defaultPlan', 'defaultValue', 'studentCount', 'courseFaqs', 'hasCourse', 'ratings', 'averageRating') ); } /** * @param $slugCategory * @param $slugCourse * @return \Illuminate\View\View */ public function indexCategoryCourse($slugCategory, $slugCourse) { $category = $this->categoryRepo->findByField('slug', $slugCategory)->first(); return view('site.course.categories_courses', compact('category')); } /** * @param Request $request * @return string */ public function ajaxHtml(Request $request) { $data = $request->all(); $course = $this->courseRepo->find($data['course_id']); $ret = HtmlHelper::lpCoursePlan($course, $data['installments'], $data['plan_id']); return $ret; } }
Copyright © 2026 - UnknownSec