where('lang', '=', $lang)->get(); //$data['slides'] = Slides::get(); $data['contact'] = Contact::where('lang', '=', $lang)->get(); $data['categories'] = Categories::select('id', 'title', 'seo_url')->where('parent_id', '=', '0')->where('lang', '=', $lang)->orderBy('order', 'ASC')->get(); $data['products'] = Products::select('products.id', 'products.title', 'products.product_code', 'products.photo', 'products.seo_url', 'categories.seo_url AS category_url', 'categories.icon')->join('categories', 'categories.id', '=', 'products.category_id')->where('products.lang', '=', $lang)->where('products.show_products', '=', '1')->get(); return View::make('front.products.Main', $data); } public function category($lang, $category_url) { App::setLocale($lang); $data = Array(); $data['lang'] = $lang; $data['category'] = Categories::where('seo_url', '=', $category_url)->where('lang', '=', $lang)->get(); $data['menu'] = Menu::select('id', 'title', 'seo_url', 'content')->where('lang', '=', $lang)->get(); //$data['slides'] = Slides::get(); $data['contact'] = Contact::where('lang', '=', $lang)->get(); $data['categories'] = Categories::select('id', 'title', 'seo_url')->where('parent_id', '=', '0')->where('lang', '=', $lang)->orderBy('order', 'ASC')->get(); if ($data['category'][0]->parent_id != 0) { $data['sub_categories'] = Categories::select('id', 'title', 'seo_url')->where('parent_id', '=', $data['category'][0]->parent_id)->where('lang', '=', $lang)->orderBy('order', 'ASC')->get(); } else { $data['sub_categories'] = Categories::select('id', 'title', 'seo_url')->where('parent_id', '=', $data['category'][0]->id)->where('lang', '=', $lang)->orderBy('order', 'ASC')->get(); } $data['products'] = Products::select('products.id', 'products.title', 'products.product_code', 'products.photo', 'products.seo_url', 'categories.seo_url AS category_url') ->join('categories', 'categories.id', '=', 'products.category_id') ->where('products.category_id', '=', $data['category'][0]->id) ->orWhere('categories.parent_id', '=', $data['category'][0]->id) ->where('products.lang', '=', $lang) ->orderBy('products.order', 'ASC') ->get(); // $queries = DB::getQueryLog(); // $last_query = end($queries); // print_r ($last_query); return View::make('front.products.Category', $data); } public function detail($lang, $category_url, $seo_url, $id) { App::setLocale($lang); $data = Array(); $data['lang'] = $lang; $data['content'] = Products::where('id', '=', $id)->where('lang', '=', $lang)->get(); $data['category'] = Categories::where('id', '=', $data['content'][0]->category_id)->where('lang', '=', $lang)->get(); if ($data['category'][0]->seo_url != $category_url) { return Redirect::to($lang . '/' . $data['category'][0]->seo_url . '/' . $data['content'][0]->seo_url . "/$id.html", 301); } $data['keywords'] = Keywords::where('product_id', '=', $id)->get(); $data['galleries'] = Productgalleries::where('product_id', '=', $id)->get(); $data['menu'] = Menu::select('id', 'title', 'seo_url', 'content')->where('lang', '=', $lang)->get(); //$data['slides'] = Slides::get(); $data['contact'] = Contact::where('lang', '=', $lang)->get(); $data['categories'] = Categories::select('id', 'title', 'seo_url')->where('parent_id', '=', '0')->where('lang', '=', $lang)->orderBy('order', 'ASC')->get(); if ($data['category'][0]->parent_id != 0) { $data['sub_categories'] = Categories::select('id', 'title', 'seo_url')->where('parent_id', '=', $data['category'][0]->parent_id)->where('lang', '=', $lang)->orderBy('order', 'ASC')->get(); } else { $data['sub_categories'] = Categories::select('id', 'title', 'seo_url')->where('parent_id', '=', $data['category'][0]->id)->where('lang', '=', $lang)->orderBy('order', 'ASC')->get(); } $data['random_category_products'] = Products::select('products.*', 'categories.seo_url AS category_url')->join('categories', 'categories.id', '=', 'products.category_id')->where('category_id', '=', $data['category'][0]->id)->where('products.lang', '=', $lang)->orderBy(DB::raw('RAND()'))->get(); $data['comments'] = DB::table('productscomments')->where('status', '=', '1')->get(); if (Request::isMethod('put')) { Input::flash(); $commentData = array( 'comment_name' => Input::get('comment_name'), 'comment_email' => Input::get('comment_email'), 'comment' => Input::get('comment'), 'comment_captcha' => Input::get('comment_captcha'), 'product_id' => Input::get('product_id') ); $commentRules = array( 'comment_name' => 'required|min:3', 'comment_email' => 'required|email', 'comment' => 'required', 'comment_captcha' => 'required|captcha', 'product_id' => 'required|integer' ); $commentValidator = Validator::make($commentData, $commentRules); if ($commentValidator->fails()) { Session::flash('commentResults', 'Lütfen Formdaki bilgileri doğru doldurunuz.'); } else { $comment = new Procuctscomments; $comment->product_id = Input::get('product_id'); $comment->namesurname = Input::get('comment_name'); $comment->email = Input::get('comment_email'); $comment->comment = Input::get('comment'); $comment->status = '0'; $comment->ip_address = getenv("REMOTE_ADDR"); if ($comment->save()) { Session::flash('commentResults', 'Yorumunuz kaydedilmiştir, Onay sürecinde.'); } else { Session::flash('commentResults', 'Yorumunuz kaydedilirken bir hata oluştu.'); } } } return View::make('front.products.Detail', $data); } public function search($lang) { $kelime = Input::get('urun_ara'); if ($kelime != '') { App::setLocale($lang); $data = Array(); $data['lang'] = $lang; $data['menu'] = Menu::select('id', 'title', 'seo_url', 'content')->where('lang', '=', $lang)->get(); $data['contact'] = Contact::where('lang', '=', $lang)->get(); $data['categories'] = Categories::select('id', 'title', 'seo_url')->where('parent_id', '=', '0')->where('lang', '=', $lang)->orderBy('order', 'ASC')->get(); $data['products'] = Products::select('products.id', 'products.title', 'products.product_code', 'products.photo', 'products.seo_url', 'categories.seo_url AS category_url') ->join('categories', 'categories.id', '=', 'products.category_id') ->where('products.title', 'LIKE', "%$kelime%") ->orWhere('products.keywords', 'LIKE', "%$kelime%") ->orWhere('products.product_code', '=', "$kelime") ->orWhere('products.content', 'LIKE', "%$kelime%") ->where('products.lang', '=', $lang) ->orderBy('products.order', 'ASC') ->get(); return View::make('front.products.Search', $data); } else { return Redirect::to(Redirect::back()); } } } Redirecting to http://basketbolpotasi.info.tr Redirecting to http://basketbolpotasi.info.tr.