app/Http/Controllers/ShopController.php
/**
     * Display a user courses list page.
     *
     * @return \Illuminate\Http\Response
     */
Display a user courses list page.
@return \Illuminate\Http\Response
Display a user courses list page . @return \ Illuminate \ Http \ Response
public function myCourses($type)
    {
        $acceptedType = ['factor', 'course'];
        if (!in_array($type, $acceptedType)) {
            return redirect()->route('panel.dashboard');
        }
        $userCourses = Factor::where('is_paid', 1)->where('user_id', Auth::user()->id)->orderBy('id', 'DESC')->paginate(15);
        if ($type == 'course') {
            return view('panel.shop.myCourses', compact('userCourses'));
        }
        return view('panel.shop.myFactors', compact('userCourses'));
    }
public function myCourses ( $ type ) { $ acceptedType = [ 'factor' , 'course' ] ; if ( ! in_array ( $ type , $ acceptedType ) ) { return redirect ( ) -> route ( 'panel.dashboard' ) ; } $ userCourses = Factor :: where ( 'is_paid' , 1 ) -> where ( 'user_id' , Auth :: user ( ) -> id ) -> orderBy ( 'id' , 'DESC' ) -> paginate ( 15 ) ; if ( $ type == 'course' ) { return view ( 'panel.shop.myCourses' , compact ( 'userCourses' ) ) ; } return view ( 'panel.shop.myFactors' , compact ( 'userCourses' ) ) ; }
Display a user courses list page.
Display a user courses list page .