コード例 #1
0
 public function category($category)
 {
     $category = str_replace('-', ' ', $category);
     $category = str_replace('_', ' ', $category);
     //        return Store::join('categories','stores.id','=','categories.store_id')
     //        ->where('categories.name',$category)
     //            ->select('categories.name as category','categories.cashback as cashback','stores.name as store_name', 'stores.slug as slug')->get();
     return view('category')->with('stores', Store::join('categories', 'stores.id', '=', 'categories.store_id')->where('categories.name', $category)->select('categories.name as category', 'stores.max_cashback as max_cashback', 'stores.name as store_name', 'stores.image as image', 'stores.slug as slug')->get())->with('category', $category);
 }
コード例 #2
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     //
     view()->composer('general.nav', function ($view) {
         $view->with('all_stores', Store::ordered()->get())->with('all_categories', Constants::availableCategories());
     });
     view()->composer('general.footer', function ($view) {
         $view->with('all_categories', Constants::availableCategories());
     });
     view()->composer('general.featured_offers', function ($view) {
         $view->with('featured_offers', Offer::featuredOffers());
     });
     view()->composer('general.featured_stores', function ($view) {
         $view->with('featured_stores', Store::featured());
     });
 }
コード例 #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     File::delete(Store::find($id)->image);
     Store::destroy($id);
     return redirect('admin/stores');
 }
コード例 #4
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     return view('admin.transactions.edit')->with('stores', Store::all())->with('users', User::all())->with('transaction', Transaction::find($id));
 }
コード例 #5
0
 public function get_store_categories($id)
 {
     return view('admin/stores/categories')->with('categories', Store::find($id)->getCategories()->paginate(25))->with('store', Store::find($id));
 }
コード例 #6
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int $id
  * @return Response
  */
 public function edit($id)
 {
     //
     $offer = Offer::find($id);
     $categories = Category::join('stores', 'stores.id', '=', 'categories.store_id')->select(['stores.name as store_name', 'categories.name', 'categories.id'])->orderBy('stores.name', 'asc')->orderBy('categories.name', 'asc')->get();
     $stores = Store::ordered()->get();
     $values = [];
     foreach ($stores as $store) {
         $cats = [];
         foreach ($categories as $category) {
             if (strcmp($category['store_name'], $store['name']) == 0) {
                 $cats[] = array('id' => $category['id'], 'name' => $category['name']);
             }
         }
         $values[$store['name']] = $cats;
     }
     return view('admin.offers.edit')->with('categories', $values)->with('category_id', $offer->category_id)->with('store_name', Category::find($offer->category_id)->getStore()->name)->with('offer', $offer);
 }