Пример #1
0
 public function getPurchase()
 {
     if (!Auth::user()) {
         return redirect('register');
     }
     $courses = Course::all();
     return view('user.purchase', compact('courses'));
 }
Пример #2
0
 public function show(Request $request, $courseSlug, $slug)
 {
     if ($request->user() and $request->user()->hasRole('student')) {
         $lesson = Lesson::where('slug', $slug)->firstOrFail();
         $courses = Course::where('published', 1)->get();
         return view('lesson.show', compact('lesson', 'courses'));
     } else {
         return redirect('purchase');
     }
     return redirect('login')->withErrors('You must be logged in to view this lesson.');
 }
Пример #3
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $courses = Course::where('published', 1)->orderBy('id', 'desc')->take(18)->get();
     return view('base.home', compact('courses'));
 }
Пример #4
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $courses = Course::all();
     return view('admin.post.create', compact('courses'));
 }
Пример #5
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $lesson = Lesson::findOrFail($id);
     $courses = Course::all();
     return view('admin.lesson.show', compact('lesson', 'courses'));
 }
Пример #6
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $courses = Course::all();
 }
Пример #7
0
 public function show($slug)
 {
     $course = Course::where('slug', $slug)->firstOrFail();
     $courses = Course::where('published', 1)->get();
     return view('course.show', compact('course', 'courses'));
 }
Пример #8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Course::truncate();
     factory(Course::class, 100)->create();
 }