/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::statement('SET FOREIGN_KEY_CHECKS=0;'); DB::table('divisions')->truncate(); DB::table('categories')->truncate(); DB::table('sub_categories')->truncate(); DB::table('brands')->truncate(); DB::table('skus')->truncate(); $reader = ReaderFactory::create(Type::XLSX); // for XLSX files $filePath = 'database/seeds/seed_files/Items.xlsx'; $reader->open($filePath); foreach ($reader->getSheetIterator() as $sheet) { if ($sheet->getName() == 'SKU Data') { $rowcnt = 0; foreach ($sheet->getRowIterator() as $row) { if ($rowcnt > 1) { if (!is_null($row[0])) { $division = Division::firstOrCreate(['division' => $row[8]]); $category = Category::firstOrCreate(['category_short' => strtoupper($row[1]), 'category_long' => strtoupper($row[0])]); $sub_category = SubCategory::firstOrCreate(['subcategory' => strtoupper($row[6])]); $brand = Brand::firstOrCreate(['brand' => strtoupper($row[7])]); $sku = Sku::firstOrCreate(['division_id' => $division->id, 'category_id' => $category->id, 'sub_category_id' => $sub_category->id, 'brand_id' => $brand->id, 'sku_code' => $row[2], 'item_desc' => $row[3], 'sku_desc' => $row[4], 'conversion' => $row[5]]); } } $rowcnt++; } } } $reader->close(); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); Model::reguard(); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $brand = new Brand(); $brand->name = Input::get('name'); $brand->save(); return Redirect()->route('brand-list'); }
/** * */ public function loadFeed() { $xml = $this->reader->load($this->feedUrl); $content = $xml->getContent(); $this->content = $xml->getContent(); foreach ($content as $product) { $item = Product::where('externalUrl', '=', $product->productUrl)->first(); if (!$item) { $item = new Product(); } if (strlen($product->brand) > 1) { $brand = Brand::where('name', '=', $product->brand)->first(); if (!$brand) { $brand = new Brand(); $brand->name = $product->brand; $brand->save(); } if ($brand->id) { $item->brand = $brand->id; } } $item->name = $product->name; $item->description = $product->description; $item->price = $product->price; $item->regularPrice = $product->regularPrice; $item->shippingPrice = $product->shippingPrice; $item->externalUrl = $product->productUrl; $item->imageUrl = $product->graphicUrl; $item->save(); } }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Requests\BrandRequest $request) { $brand = new \App\Brand(); $brand->city_id = $request->city_id; $brand->brand_type_id = $request->brand_type_id; $brand->brand_name = $request->brand_name; $brand->description = $request->description; $brand->logo = $request->logo; $brand->video = $request->video; $brand->save(); return redirect('admin/brands'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Name $name) { // Edit an exisiting name $brands = Brand::lists('short_name', 'id'); $statuses = Status::lists('name', 'id'); return view('names.edit', compact('name', 'brands', 'statuses')); }
/** * Run the database seeds. * * @return void */ public function run() { //Truncate DB::statement('SET FOREIGN_KEY_CHECKS=0;'); User::truncate(); Admin::truncate(); Customer::truncate(); Address::truncate(); Category::truncate(); Product::truncate(); Brand::truncate(); Type::truncate(); Image::truncate(); DB::statement('TRUNCATE category_product;'); Product::clearIndices(); Product::reindex(); //Unguard Model::unguard(); //Call $this->call(UsersTableSeeder::class); $this->call(ProductsTableSeeder::class); //Reguard Model::reguard(); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Idea $idea) { // Edit an exisiting idea $brands = Brand::lists('short_name', 'id'); $industries = Industry::lists('name', 'id'); return view('ideas.edit', compact('idea', 'brands', 'industries')); }
public function special(Request $request, $activity_id = 0) { $stores_ids = $this->user->stores->pluck('id'); $this->_brands = Brand::join('store_brand as s', 's.bid', '=', 'brands.id')->whereIn('s.sid', $stores_ids)->get(['brands.*']); $pagesize = $request->input('pagesize') ?: $this->site['pagesize']['m']; $this->_input = $request->all(); $product = new Product(); //查找猴子捞月所有在线,有效活动id $now = date("Y-m-d H:i:s"); if (!empty($activity_id)) { $activity = Activity::find($activity_id); } elseif (!empty($request->get('type_id'))) { $fids = $product->newQuery()->whereIn('bid', $this->_brands->pluck('id'))->pluck('fid'); if (!empty($fids)) { $fids = array_unique((array) $fids); } $builder = Activity::whereIn('fid', $fids)->where('type_id', $request->get('type_id')); $activity = $builder->first(); $activity_id = $builder->pluck('id'); } else { return $this->failure(NULL); } if (empty($activity)) { return $this->failure('activity::activity.no_activity'); } elseif ($activity->start_date > $now || $activity->end_date < $now || $activity->status != 1) { return $this->failure('activity::activity.failure_activity'); } //查看当前以以和店铺 猴子捞月 活动所有商品 $builder = $product->newQuery()->with(['sizes', 'covers']); $this->_activity = $activity; $this->_table_data = $builder->whereIn('activity_type', (array) $activity_id)->whereIn('bid', $this->_brands->pluck('id'))->paginate($pagesize); return $this->view('activity::m.special'); }
public function listBrandPictures($brandid) { $brand = Brand::findorFail($brandid); // get the brand pictures $brandPictures = $brand->pictures()->get(); return view('fileentries.listPictures')->with(compact('brandPictures')); }
/** * Run the database seeds. * * @return void */ public function run() { $brand = Brand::create(['name' => 'Opel', 'code' => '']); BrandModel::create(['name' => 'Corsa', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Vectra', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Insignia', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Astra', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Mondeo', 'code' => '', 'brand_id' => $brand->id]); $brand = Brand::create(['name' => 'Audi', 'code' => '']); BrandModel::create(['name' => 'A1', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A2', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A3', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A4', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A5', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'TT', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A6', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A7', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'A8', 'code' => '', 'brand_id' => $brand->id]); $brand = Brand::create(['name' => 'Renault', 'code' => '']); BrandModel::create(['name' => 'Clio', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Espace', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Kangoo', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Megane', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Laguna', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Modus', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Fluence', 'code' => '', 'brand_id' => $brand->id]); BrandModel::create(['name' => 'Captur', 'code' => '', 'brand_id' => $brand->id]); $brand = Brand::create(['name' => 'Fiat', 'code' => '']); $brand = Brand::create(['name' => 'BMW', 'code' => '']); $brand = Brand::create(['name' => 'Seat', 'code' => '']); }
public function export(Request $request) { $brand = new Brand(); $builder = $brand->newQuery()->join('agent_brand', 'agent_brand.bid', '=', 'brands.id')->where('aid', $this->agent->getKey())->groupBy('brands.id'); $page = $request->input('page') ?: 0; $pagesize = $request->input('pagesize') ?: config('site.pagesize.export', 1000); $total = $this->_getCount($request, $builder); if (empty($page)) { $this->_of = $request->input('of'); $this->_table = $brand->getTable(); $this->_total = $total; $this->_pagesize = $pagesize > $total ? $total : $pagesize; return $this->view('agent-backend.brand.export'); } $data = $this->_getExport($request, $builder, null, ['brands.*']); return $this->success('', FALSE, $data); }
public function getBrandLogo(Request $request, $brandId) { $brand = Brand::find($brandId); if ($brand === null || $brand->logo === '') { return Response::make('', 200); } return Image::make(Storage::disk('s3')->get($brand->logo))->response(); }
public function addProduct() { $page = 'partials.admin-addProduct'; $users = User::all(); $types = Type::all(); $brands = Brand::all(); return view('quantri/admin', compact('page', 'users', 'brands', 'types')); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $brands = new Brand(); $brands = Brand::all(); $categorys = new Category(); $categorys = Category::all(); return view('product.createProduct', ['categorys' => $categorys, 'brands' => $brands]); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $categories = Category::all(); $brands = Brand::all(); $size = Size::all(); $color = Color::all(); return view('admin.product.add', compact('categories', 'brands', 'size', 'color')); }
public function update($id, BrandFormRequest $request) { $brand = Brand::find($id); $brand_name = $request->input('brand_name'); $brand_type = $request->input('brand_type'); $brand->update(['brand_name' => $brand_name, 'brand_type' => $brand_type]); return redirect()->route('admin.brandManagement'); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $brands = new Brand(); $brands = Brand::all(); $category = new Category(); $categorys = Category::all(); return view('blogList.blogList', ['categorys' => $categorys, 'brands' => $brands]); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $store = Store::find($id); $days = Day::all(); $brands = Brand::lists('brand_name', 'id')->all(); $payment_types = PaymentType::lists('type_name', 'id')->all(); return view('admin.stores.edit', compact('store', 'days', 'brands', 'payment_types')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $brands = new Brand(); $brands = Brand::all(); $category = new Category(); $categorys = Category::all(); return view('singleBlog.singleBlog', ['categorys' => $categorys, 'brands' => $brands]); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Stack $stack) { // Edit an exisiting stack $brands = Brand::lists('short_name', 'id'); $banks = Bank::lists('name', 'id'); $types = Type::whereIn('tablename', ['all', 'stacks'])->lists('name', 'id'); return view('stacks.edit', compact('stack', 'brands', 'banks', 'users', 'types')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit(Director $director) { // Edit an exisiting director $brands = Brand::lists('short_name', 'id'); $statuses = Status::lists('name', 'id'); $genders = Gender::lists('name', 'id'); $titles = Title::lists('name', 'id'); return view('directors.edit', compact('director', 'brands', 'statuses', 'users', 'titles', 'genders')); }
/** * Show the application dashboard. * * @return Response */ public function index() { $articleCount = Article::all()->count(); $partTypeCount = PartType::all()->count(); $brandsCount = Brand::all()->count(); $modelCount = BrandModel::all()->count(); // dd($articleCount); return view('home')->with(['articleCount' => $articleCount, 'partTypeCount' => $partTypeCount, 'brandsCount' => $brandsCount, 'modelCount' => $modelCount]); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('brands')->delete(); Brand::create(array('brand_name' => 'iPhone')); Brand::create(array('brand_name' => 'SamSung')); Brand::create(array('brand_name' => 'Sony')); Brand::create(array('brand_name' => 'Oppo')); Brand::create(array('brand_name' => 'Nokia')); }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { switch ($this->method()) { case 'POST': return ['name' => 'required|max:255|unique:brands,name']; case 'PATCH': $brand = Brand::find($this->brands); return ['name' => 'required|max:255|unique:brands,name,' . $brand->id]; } }
public function getBrands(Request $request) { if ($request->input('q')) { $search_query = $request->input('q'); $brands = Brand::where('name', 'like', '%' . $search_query . '%')->get(); } else { $brands = Brand::all(); } return response()->json($brands); }
public function index() { $categories = Category::all(); $brands = Brand::all(); $modele = Modeles::with('category', 'brand')->get(); $articles_modeles = Modeles::with('articles')->get(); $leftmenu['model'] = 'active'; $leftmenu['model_gerer'] = 'active'; return view('/modeles/index', ['leftmenu' => $leftmenu, 'categories' => $categories, 'brands' => $brands, 'modeles' => $modele, 'artmod' => $articles_modeles]); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $brands = new Brand(); $brands = Brand::all(); $category = new Category(); $categorys = Category::all(); $products = new Product(); $products = Product::all(); return view('home', ['categorys' => $categorys, 'brands' => $brands, 'products' => $products]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index(Model $objects, $brand_id = 'all', $district_id = 'all') { $brand = $brand_id; $district = $district_id; $brands = Brand::all(); $districts = District::getLocalizedWithCounts(); $selected_district = District::getLocalizedDistrict($district); if (!$selected_district) { $selected_district = 'all'; } return view('portfolio', ['categories' => $this->categories, 'objects' => $objects->getLocalizedPaginate(9, $brand, $district), 'brands' => $brands, 'districts' => $districts, 'selected_brand' => $brand, 'selected_district' => $selected_district, 'title' => LANG . '_title']); }
/** * Display a listing of the resource. * * @return Response */ public function index($id) { $product = new Product(); $product = Product::find($id); $categorys = new Category(); $categorys = Category::all(); $brands = new Brand(); $brands = Brand::all(); $reviews = new Review(); $reviews = $reviews = DB::table('review')->where('product_id', '=', $id)->get(); return view('productDetails.productDetails', ['product' => $product, 'categorys' => $categorys, 'brands' => $brands, 'reviews' => $reviews]); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $this->validate($request, ['name' => 'required|max:255']); $input = $request->all(); $input['branch_id'] = Auth::user()->branch_id; $input['company_id'] = Auth::user()->company_id; $input['user_id'] = Auth::user()->id; $input['account_year_id'] = session('account'); Brand::create($input); flash()->success('Brand Created Successfully !'); return redirect('brand'); }