/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $courses = Course::with('university')->get()->toArray();
     if (count($courses) > 0) {
         $message = 'Success';
         return Response()->json(ResponseManager::getResult($courses, 10, $message));
     } else {
         $message = 'Error';
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
 }
示例#2
0
 /**
  * @GET("/profile", as="profile.index")
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function index()
 {
     $profile = $this->profile->profileWithUser();
     $courses_raw = Course::with('currency')->get();
     $courses = $courses_raw->filter(function ($value) {
         return $value->id != 11;
     });
     if (!$profile->wallet) {
         \Session::flash('message', 'Пожалуйста, укажите Elcoin кошелек и полностью заполните профиль, если у Вас нет кошелька,
         зарегистрируйтесь в системе Elephant: https://elcoin.space');
     }
     return view('profile.profile', compact('profile', 'courses'));
 }
 public function getOverview()
 {
     if (Auth::user()->hasRole(User::STUDENT_ROLE)) {
         $courses = Course::with(['teacher', 'participants' => function ($query) {
             $query->where('user_id', '=', Auth::id());
         }])->orderBy('name')->paginate(10);
         return view('courses.student.overview', ['courses' => $courses]);
     } else {
         $course = Auth::user()->course;
         if ($course) {
             $participants = $course->participants()->paginate(10);
         } else {
             $participants = [];
         }
         return view('courses.teacher.overview', ['participants' => $participants]);
     }
 }
示例#4
0
 /**
  * @POST("/get_currency_elcoin")
  * @return string
  */
 public function get_elcoin()
 {
     $course = Course::with('currency')->where('currency_id', 11)->first()->toArray();
     return json_encode($course);
 }
 /**
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function index()
 {
     $courses = Course::with('currency')->get();
     return view('admin.course.index', compact('courses'));
 }