Esempio n. 1
0
 public function index($content_name)
 {
     $content = Content::find(id_from_name($content_name));
     $recommends = Content::where('id', '!=', $content->id)->where('recommend', 1)->take(config('app.frontEnd.content.recommend_show'))->get();
     if (count($recommends) === 0) {
         $recommends = Content::where('id', '!=', $content->id)->orderByRaw("RAND()")->take(config('app.frontEnd.content.recommend_show'))->get();
     }
     return view('detail', ['adsCategories' => AdsCatg::all(), 'category_menus' => Category::all(), 'content' => $content, 'date' => new Carbon(), 'recomend_contents' => $recommends, 'user' => Auth::user()]);
 }
Esempio n. 2
0
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $categories = Category::all();
     return view('index', ['adsCategories' => AdsCatg::all(), 'category_menus' => $categories, 'categories' => $categories, 'user' => Auth::user()]);
 }
Esempio n. 3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     return view('admin.advertise.insertupdate', ['advertise' => Advertise::find($id), 'adsCategories' => AdsCatg::all()]);
 }
Esempio n. 4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $catg = AdsCatg::find($id);
     if ($catg) {
         $catg->delete();
     }
     return redirect()->action('Admin\\CatgAdsController@index');
 }
Esempio n. 5
0
 public function searchContent(Request $request)
 {
     $contents = Content::where('name', 'like', '%' . spaceToLike($request->input('key_word')) . '%')->paginate(config('app.frontEnd.content.per_page'));
     return view('searchContent', ['adsCategories' => AdsCatg::all(), 'category_menus' => Category::all(), 'contents' => $contents, 'keyword' => $request->input('key_word'), 'user' => Auth::user()]);
 }
Esempio n. 6
0
 public function index($category_name)
 {
     $category_id = Category::where('name', $category_name)->first()->id;
     $contents = Content::where('category_id', $category_id)->where('status', 'approve')->paginate(config('app.frontEnd.content.per_page'));
     return view('category', ['adsCategories' => AdsCatg::all(), 'category_menus' => Category::all(), 'contents' => $contents, 'user' => Auth::user()]);
 }