/**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     view()->composer('partials.latestArticles', function ($view) {
         $latestArticles = Article::published()->active()->latest()->take(10)->get();
         $view->with(['latestArticles' => $latestArticles]);
     });
     view()->composer('partials.latestCourses', function ($view) {
         $latestCourses = Course::latest()->take(10)->get();
         $view->with(['latestCourses' => $latestCourses]);
     });
     view()->composer('partials.latestSessions', function ($view) {
         $latestSessions = Session::latest()->take(10)->get();
         $view->with(['latestSessions' => $latestSessions]);
     });
     view()->composer('partials.categories', function ($view) {
         $totalCategories = DB::table('categories')->where('depth', '=', 1)->leftJoin('category_course', 'categories.id', '=', 'category_course.category_id')->leftJoin('article_category', 'categories.id', '=', 'article_category.category_id')->groupBy('categories.id')->select('categories.name', 'categories.id', DB::raw('COUNT(`course_id`) + COUNT(`article_id`) AS num'))->orderBy('num', 'DESC')->get();
         $view->with(['totalCategories' => $totalCategories]);
     });
 }
예제 #2
0
 public function index()
 {
     $courses = Course::latest('start_date')->published()->get();
     return view('pages.courses')->with('courses', $courses);
 }
예제 #3
0
 public function main()
 {
     $courses = Course::latest('published_at')->Published()->Done()->Paginate(15);
     return view('pages.main', compact('courses'));
 }
예제 #4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $courses = Course::latest()->get();
     //dd($courses);
     return view('courses.index', compact('courses'));
 }
예제 #5
0
 public function index()
 {
     $courses = Course::latest()->get();
     return view('course.list', compact('courses'))->with(['title' => 'دوره های آموزشی آنلاین']);
 }
 public function composeNavigation()
 {
     view()->composer('partials.nav', function ($view) {
         $view->with('latest', Course::latest()->first());
     });
 }
예제 #7
0
 public function index()
 {
     $courses = Course::latest()->get();
     $articles = Article::published()->active()->latest()->paginate(10);
     return view('home.index', compact('courses', 'articles'))->with(['title' => $this->config['title'], 'meta_description' => $this->config['description'], 'meta_keywords' => $this->config['keywords']]);
 }