/**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function showCheckout()
 {
     $market_data = Market::with('category')->get();
     if (Auth::check()) {
         $id = Auth::user()->login_id;
         $user = User::where('id', $id)->with('member')->get();
         return view('client.pages.checkout-address')->with('user', $user)->with('market_data', $market_data);
     } else {
         return view('client.pages.checkout-address')->with('market_data', $market_data);
     }
 }
 public function showCustomerAccount($id, $type)
 {
     //if($type=="Info"||$type=="Favorites"||$type=="Wishlist"){
     $market_data = Market::with('category')->get();
     $city = City::with('area')->get();
     if (Auth::check()) {
         $id = Auth::user()->login_id;
         $user = User::where('id', $id)->with('member')->get();
         return view('client.pages.account-page')->with('user', $user)->with('market_data', $market_data)->with('city', $city)->with('type', $type);
     } else {
         return redirect('/Market');
     }
 }
示例#3
0
 public function run()
 {
     DB::table('users')->delete();
     DB::table('markets')->delete();
     DB::table('default_attributes')->delete();
     DB::table('items')->delete();
     DB::table('item_attributes')->delete();
     DB::table('item_photos')->delete();
     $oscar = User::create(['id' => 1, 'first_name' => 'Oscar', 'last_name' => 'van Ruiten', 'email' => '*****@*****.**', 'password' => bcrypt('secret'), 'country' => 'The Netherlands', 'state' => 'South-Holland', 'postal_code' => '3000', 'phone' => '0479671567']);
     $udo = User::create(['id' => 2, 'first_name' => 'Steven', 'last_name' => 'Grauwmans', 'email' => '*****@*****.**', 'password' => bcrypt('secret'), 'country' => 'Belgium', 'state' => 'Antwerp', 'postal_code' => '2323', 'phone' => '0479343719', 'created_at' => '2015-10-10']);
     $bikes = Market::create(['id' => 1, 'name' => 'Bikes', 'description' => 'Market for bikes.', 'upvote' => 500]);
     $cars = Market::create(['id' => 2, 'name' => 'Cars', 'description' => 'Market for cars.', 'upvote' => 500]);
     $retro = Market::create(['id' => 3, 'name' => 'Retro', 'description' => 'Market for retro stuff.', 'upvote' => 234]);
     $design = Market::create(['id' => 4, 'name' => 'Designer furniture', 'description' => 'Market for expensive sheeeeeet.', 'upvote' => 499]);
     $fruit = Market::create(['id' => 5, 'name' => 'Fruit', 'description' => 'Market for fresh bananas.', 'upvote' => 350]);
     DefaultAttribute::create(['id' => 1, 'name' => 'Color', 'market_id' => $bikes->id]);
     DefaultAttribute::create(['id' => 2, 'name' => 'Frame size', 'market_id' => $bikes->id]);
     DefaultAttribute::create(['id' => 3, 'name' => 'Brand', 'market_id' => $cars->id]);
     $trek = Item::create(['id' => 1, 'name' => 'Trek Bike', 'description' => 'This is an add for a Trek Bike.', 'price' => 500, 'by_mail' => 0, 'views' => 10, 'user_id' => $oscar->id]);
     $ferrari = Item::create(['id' => 2, 'name' => 'Ferrari 3000', 'description' => 'This is an add for a Ferrari 3000.', 'price' => 19999999, 'by_mail' => 0, 'views' => 1000, 'user_id' => $udo->id]);
     $saddle = Item::create(['id' => 3, 'name' => 'Brooks saddle', 'description' => 'This is an add for a Brooks saddle.', 'price' => 50, 'by_mail' => 1, 'views' => 50, 'user_id' => $oscar->id]);
     $tire = Item::create(['id' => 4, 'name' => 'Rubber tire', 'description' => 'This is an add for a rubber tire.', 'price' => 10, 'by_mail' => 1, 'views' => 20, 'user_id' => $oscar->id]);
     $toyota = Item::create(['id' => 5, 'name' => 'Toyota Celica', 'description' => 'This is an add for a Japanse car.', 'price' => 1500, 'by_mail' => 0, 'views' => 150, 'user_id' => $udo->id]);
     $chair = Item::create(['id' => 6, 'name' => 'Two seat', 'description' => 'This is an add for a leather two seater.', 'price' => 70, 'by_mail' => 0, 'views' => 35, 'user_id' => $udo->id]);
     $banana = Item::create(['id' => 7, 'name' => 'Chiquita', 'description' => 'This is an add for a box of bananas.', 'price' => 5, 'by_mail' => 1, 'views' => 6, 'user_id' => $oscar->id]);
     $armaniTable = Item::create(['id' => 8, 'name' => 'Table', 'description' => 'This is an add for a Armani table.', 'price' => 50, 'by_mail' => 1, 'views' => 50, 'user_id' => $oscar->id]);
     ItemAttribute::create(['id' => 1, 'name' => 'Color', 'value' => 'black', 'item_id' => $trek->id]);
     ItemAttribute::create(['id' => 2, 'name' => 'Brand', 'value' => 'Ferrari', 'item_id' => $ferrari->id]);
     ItemAttribute::create(['id' => 3, 'name' => 'Frame size', 'value' => '58', 'item_id' => $saddle->id]);
     ItemAttribute::create(['id' => 4, 'name' => 'Color', 'value' => 'green', 'item_id' => $tire->id]);
     ItemAttribute::create(['id' => 5, 'name' => 'Color', 'value' => 'yellow', 'item_id' => $toyota->id]);
     ItemAttribute::create(['id' => 6, 'name' => 'Color', 'value' => 'pink', 'item_id' => $chair->id]);
     ItemAttribute::create(['id' => 7, 'name' => 'Color', 'value' => 'orange', 'item_id' => $banana->id]);
     ItemAttribute::create(['id' => 8, 'name' => 'Color', 'value' => 'white', 'item_id' => $armaniTable->id]);
     ItemPhoto::create(['id' => 1, 'filename' => 'no_image.png', 'item_id' => $trek->id]);
     ItemPhoto::create(['id' => 2, 'filename' => 'no_image.png', 'item_id' => $ferrari->id]);
     ItemPhoto::create(['id' => 3, 'filename' => 'no_image.png', 'item_id' => $saddle->id]);
     ItemPhoto::create(['id' => 4, 'filename' => 'no_image.png', 'item_id' => $tire->id]);
     ItemPhoto::create(['id' => 5, 'filename' => 'no_image.png', 'item_id' => $toyota->id]);
     ItemPhoto::create(['id' => 6, 'filename' => 'no_image.png', 'item_id' => $chair->id]);
     ItemPhoto::create(['id' => 7, 'filename' => 'no_image.png', 'item_id' => $banana->id]);
     ItemPhoto::create(['id' => 8, 'filename' => 'no_image.png', 'item_id' => $armaniTable->id]);
     $trek->markets()->attach($bikes->id);
     $ferrari->markets()->attach($cars->id);
     $saddle->markets()->attach($bikes->id);
     $tire->markets()->attach($bikes->id);
     $toyota->markets()->attach($cars->id);
     $chair->markets()->attach($design->id);
     $banana->markets()->attach($fruit->id);
     $armaniTable->markets()->attach($design->id);
 }
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function showProductDetails($pid, $product_name)
 {
     if (ProductInfo::where('id', '=', $pid)->where('product_status', '=', '9')->exists()) {
         $ProductInfo = ProductInfo::with('product')->with('store')->with('productVariantGroup')->with('productVariant')->where('id', '=', $pid)->get();
         $fb_seo_meta = array();
         foreach ($ProductInfo as $info) {
             $name = $info->product_name;
             $store_name = $info->store->store_name;
             $store_id = $info->store->id;
             $sub_category_id = $info->sub_category_id;
             $fb_seo_meta['title'] = $store_name . ' - ' . $info->product_name;
             $fb_seo_meta['description'] = $info->product_description;
             foreach ($info->product as $piid) {
                 $product_id = $piid->id;
                 break;
             }
             break;
         }
         if (ProductInfo::where('id', '=', $pid)->where('product_name', '=', decodeUrlRoute($product_name))->exists()) {
             $market_data = Market::with('category')->get();
             $listFiles = [];
             $files = \File::files('assets/img/store/' . $store_name . '/product/' . $product_id);
             foreach ($files as $path) {
                 $listFiles[] = pathinfo($path);
             }
             $fb_seo_meta['image'] = 'assets/img/noimage.png';
             foreach ($listFiles as $seo_img) {
                 $fb_seo_meta['image'] = $seo_img['dirname'] . '/' . $seo_img['basename'];
                 break;
             }
             $store_market_data = Market::with(['category' => function ($query) use($store_id) {
                 $query->whereHas('subCategory', function ($q) use($store_id) {
                     $q->where('store_id', '=', $store_id)->groupBy('category_id');
                 });
             }])->get();
             if (Auth::check()) {
                 $id = Auth::user()->login_id;
                 $user = User::where('id', $id)->with('member')->get();
                 return view('client.pages.product-details')->with('user', $user)->with('market_data', $market_data)->with('store_market_data', $store_market_data)->with('ProductInfo', $ProductInfo)->with('ImageFiles', $listFiles)->with('OtherFiles', $listFiles)->with('fb_seo_meta', $fb_seo_meta);
             } else {
                 return view('client.pages.product-details')->with('market_data', $market_data)->with('store_market_data', $store_market_data)->with('ProductInfo', $ProductInfo)->with('ImageFiles', $listFiles)->with('OtherFiles', $listFiles)->with('fb_seo_meta', $fb_seo_meta);
                 //return $listFiles;
             }
         } else {
             return redirect('/Product/Details/' . $pid . '/' . encodeUrlRoute($name));
         }
     } else {
         return redirect('/Market');
     }
 }
 public function postAddMarket(DefaultAttributeRequest $request)
 {
     //Validate market name|description input
     $this->validate($request, ['name' => 'required|string|min:4|max:30', 'description' => 'required|string|min:10|max:255']);
     //Add market
     $newMarket = new Market();
     $newMarket->name = $request['name'];
     $newMarket->description = $request['description'];
     $newMarket->save();
     //Attach the market to the user
     $newMarket->users()->attach(Auth::user()->id, array('subscription' => 1, 'management' => 1));
     //Add market's default attributes
     foreach ($request->input('defaultAttributeNames') as $name => $value) {
         if (!empty($value)) {
             //Foreach attribute create record and associate to the market
             $attribute = new DefaultAttribute();
             $attribute->name = $value;
             $attribute->market()->associate($newMarket->id);
             $attribute->save();
         }
     }
     //If all goes successfull redirect to the newly created market
     return redirect('/m/' . $newMarket->name);
 }
示例#6
0
 private function postAddItemStepOne(ItemRequest $request)
 {
     $step = 2;
     //Get all selected markets with the defaultAttributes
     foreach ($request->input('markets') as $marketID => $boolean) {
         if ($boolean) {
             $selectedMarkets[] = Market::with('defaultAttributes')->where('id', $marketID)->first();
         }
     }
     //Set <title>
     $title = 'Add item';
     //Set Auth::check()
     $loggedIn = $this->loggedIn;
     //Get the markets for the nav and where to place item in
     $markets = $this->markets;
     //Return view item/add
     return view('item.add', compact('title', 'loggedIn', 'markets', 'step', 'selectedMarkets'));
 }
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function showStore($store_id)
 {
     $market_data = Market::with('category')->get();
     $featured_products = FeaturedProducts::with('product_info')->where('store_id', '=', $store_id)->get();
     $store_name = "samplestore";
     $store_market_data = Market::with(['category' => function ($query) use($store_id) {
         $query->whereHas('subCategory', function ($q) use($store_id) {
             $q->where('store_id', '=', $store_id)->groupBy('category_id');
             // here we filter users by the post
         });
     }])->get();
     if (Auth::check()) {
         $id = Auth::user()->login_id;
         $user = User::where('id', $id)->with('member')->get();
         return view('template1.index')->with('user', $user)->with('market_data', $market_data)->with('store_name', $store_name);
     } else {
         return view('template1.index')->with('market_data', $market_data)->with('store_market_data', $store_market_data)->with('featured_products', $featured_products)->with('store_name', $store_name);
     }
 }
示例#8
0
 public function district(Request $request)
 {
     $district_id = $request->input('district');
     $districts = District::where('id', '=', $district_id)->get();
     $sectors = Sector::where('district_id', "=", $district_id)->get();
     foreach ($sectors as $sector) {
         $sectors_ids[] = $sector->id;
     }
     $cells = Cell::whereIn('sector_id', $sectors_ids)->get();
     foreach ($cells as $cell) {
         $cells_ids[] = $cell->id;
     }
     $markets = Market::whereIn('cell_id', $cells_ids)->get();
     foreach ($markets as $market) {
         $markets_ids[] = $market->id;
     }
     $prices = Price::whereIn('market_id', $markets_ids)->get();
     return view('reports.district')->with('districts', $districts)->with('sectors', $sectors)->with('prices', $prices);
 }
示例#9
0
 public function render($request, Exception $e)
 {
     if ($this->isHttpException($e)) {
         switch ($e->getStatusCode()) {
             // not found
             case 404:
                 $market_data = Market::with('category')->get();
                 return redirect(\URL::previous())->with('market_data', $market_data);
                 break;
                 // internal error
             // internal error
             case '500':
                 $market_data = Market::with('category')->get();
                 return redirect(\URL::previous())->with('market_data', $market_data);
                 break;
             default:
                 return $this->renderHttpException($e);
                 break;
         }
     } else {
         return parent::render($request, $e);
     }
 }
 public function getLogout()
 {
     $market_data = Market::with('category')->get();
     Auth::logout();
     // logout user
     return redirect(\URL::previous())->with('market_data', $market_data);
 }
 public function getLogout()
 {
     $loginPath = 'auth/login';
     $redirectPath = '/market';
     $redirectAfterLogout = 'auth/login';
     $market_data = Market::with('category')->get();
     Auth::logout();
     // logout user
     return redirect(\URL::previous());
 }
示例#12
0
    $district = District::where('province_id', '=', $prov_id)->get();
    return Response::json($district);
});
Route::get('getSector', function () {
    $distr_id = Input::get('distr_id');
    $sector = Sector::where('district_id', '=', $distr_id)->get();
    return Response::json($sector);
});
Route::get('getCell', function () {
    $sect_id = Input::get('sect_id');
    $cell = Cell::where('sector_id', '=', $sect_id)->get();
    return Response::json($cell);
});
Route::get('getMarket', function () {
    $cell_id = Input::get('cell_id');
    $mark = Market::where('cell_id', '=', $cell_id)->get();
    return Response::json($mark);
});
Route::get('index', ['uses' => 'UserController@index', 'as' => 'index']);
Route::post('signup', ['uses' => 'UserController@signUp', 'as' => 'signup', 'middleware' => ['guest']]);
Route::get('signup', ['as' => 'signup', 'uses' => 'UserController@index']);
Route::post('signin', ['uses' => 'UserController@signIn', 'as' => 'signin', 'middleware' => ['guest']]);
Route::get('signin', ['as' => 'signin', 'uses' => 'UserController@getSignIn']);
Route::get('signout', ['uses' => 'UserController@signOut', 'as' => 'signout']);
Route::post('save', ['uses' => 'UserController@savePrice', 'as' => 'save']);
Route::get('price', ['uses' => 'UserController@priceRegistration', 'as' => 'price']);
Route::get('authe', ['uses' => 'UserController@authenticated', 'as' => 'authe']);
Route::get('profile', ['uses' => 'UserController@profile', 'as' => 'profile']);
Route::get('contact', ['uses' => 'UserController@contact', 'as' => 'contact']);
/*
|--------------------------------------------------------------------------
示例#13
0
 public function getRegister()
 {
     $loggedIn = false;
     $title = 'index';
     $markets = Market::orderBy('upvote', 'desc')->get();
     return view('auth.register', compact('title', 'markets', 'loggedIn'));
 }
 function showMarketCategoryProduct($market, $category, $type)
 {
     $market_data = Market::with('categoryStore')->orderBy('id')->get();
     $market_data_category = Market::with('category')->where('market_name', '=', $market)->get();
     $category = str_replace('-', ' ', $category);
     if ($market == "Grocery" || $market == "Apparel" || $market == "Gadget" || $market == "Furniture") {
         $fb_seo_meta = array();
         $fb_seo_meta['title'] = 'HomemallPH - ' . $market;
         $fb_seo_meta['description'] = 'Shop your favorite product and items in our ' . $market . ' market!';
         $fb_seo_meta['image'] = 'asset/img/market/' . $market . '.png';
         if (Auth::check()) {
             $id = Auth::user()->login_id;
             $user = User::where('id', $id)->with('member')->get();
             return view('client.pages.market-category-product')->with('user', $user)->with('market', $market)->with('market_data', $market_data)->with('category_name', $category)->with('type', $type)->with('fb_seo_meta', $fb_seo_meta);
         } else {
             return view('client.pages.market-category-product')->with('market', $market)->with('market_data', $market_data)->with('category_name', $category)->with('type', $type)->with('fb_seo_meta', $fb_seo_meta);
         }
     } else {
         return redirect(\URL::previous());
     }
 }
 function showMarketCategoryProduct($market, $category)
 {
     $market_data = Market::with('category')->get();
     $category = str_replace('-', ' ', $category);
     if ($market == "grocery" || $market == "apparel" || $market == "gadget" || $market == "furniture") {
         if (Auth::check()) {
             $id = Auth::user()->login_id;
             $user = User::where('id', $id)->with('member')->get();
             return view('client.pages.market-category-product')->with('user', $user)->with('market', $market)->with('market_data', $market_data)->with('category_name', $category);
         } else {
             return view('client.pages.market-category-product')->with('market', $market)->with('market_data', $market_data)->with('category_name', $category);
         }
     }
 }
 public function getExplore()
 {
     $loggedIn = $this->loggedIn;
     $title = 'index';
     $markets = $this->markets;
     $subscriptions = Subscriber::where('user_id', Auth::user()->id)->get();
     foreach ($subscriptions as $subscription) {
         $userSubscriptions[$subscription->market_id] = Market::where('id', $subscription->market_id)->first();
     }
     foreach ($markets as $market) {
         $items[$market->id] = $market->items()->orderBy('views', 'desc')->take(2)->get();
     }
     foreach ($items as $itemsSet) {
         foreach ($itemsSet as $item) {
             $users[$item->id] = $item->user;
         }
     }
     return view('environment.explore', compact('title', 'items', 'markets', 'users', 'loggedIn', 'userSubscriptions'));
 }
示例#17
0
 public function __construct()
 {
     $this->loggedIn = Auth::check();
     $this->markets = Market::orderBy('upvote', 'desc')->get();
 }
示例#18
0
 public function listmarkets()
 {
     $markets = Market::paginate(15);
     return view('admin.markets')->with('markets', $markets);
 }