/** * Display the specified dashboard. * * @param int $id * @return Response */ public function show($id) { $products = Product::all(); $records = Record::all(); $manufacturers = Manufacturer::all(); return View::make('Dashboard.index', compact('records', 'products', 'manufacturers')); }
public function run() { $this->trancate(); $faker = Faker\Factory::create(); $languages = Language::all(); $products = Product::all(); $attributes = Attribute::all(); $attributes_options = array(); foreach ($languages as $language) { $options = DB::table('attributes_options')->whereLanguageId($language->id)->get(); $options = new Illuminate\Database\Eloquent\Collection($options); $options = $options->lists("options", 'attribute_id'); $attributes_options[$language->id] = $options; } $attributes_key = $attributes->modelKeys(); $products->each(function ($product) use($attributes_key, $languages, $faker, $attributes_options) { $count_to_insert = rand(0, rand(0, count($attributes_key) - 1)); for ($i = 1; $i <= $count_to_insert; $i++) { foreach ($languages as $language) { $attribute_id = $attributes_key[rand(0, count($attributes_key) - 1)]; $options = $attributes_options[$language->id][$attribute_id]; $tokens = explode("|", $options); try { DB::table('products_to_attributes')->insert(array('product_id' => $product->id, 'language_id' => $language->id, 'attribute_id' => $attribute_id, 'value' => $tokens[rand(0, count($tokens) - 1)])); } catch (Exception $x) { var_dump($x); } } } }); }
public function getIndex() { $categories = array(); foreach (Category::all() as $category) { $categories[$category->id] = $category->name; } return View::make('products.index')->with('products', Product::all())->with('categories', $categories); }
public function dataTables() { return Datatable::collection(Product::all())->showColumns("id", "name", "identifier", "category", "import", "source_area", "brand", "price", "desc", "created_at")->addColumn('products_category', function ($model) { return Category::where('parent_code', 'PRODUCT_CATEGORY')->where('code', $model->category)->select('name as label', 'code as value')->first(); })->addSelect('products_category', function () { return Category::where('parent_code', 'PRODUCT_CATEGORY')->select('name as label', 'code as value')->get(); })->searchColumns(array('name'))->orderColumns('created_at')->setAliasMapping()->make(); }
public function products() { $ids2 = DB::table('tblProducts')->select('strProdID')->orderBy('updated_at', 'desc')->orderBy('strProdID', 'desc')->take(1)->get(); $ID2 = $ids2["0"]->strProdID; $newID2 = $this->smart($ID2); // Get all products from the database $products = Product::all(); return View::make('products')->with('products', $products)->with('newID2', $newID2); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $all = Product::all(); $op = array(); foreach ($all as $data) { $op[] = array("{$data->id}", $data->product_name, "{$data->bike_cc}", $data->model, "action"); } return json_encode(array("data" => $op)); }
public function display() { $products = Product::all(); $products = Product::orderBy('p_id', 'desc')->paginate(3); $users = User::all(); $users = User::orderBy('id', 'desc')->paginate(3); $suppliers = Product::lists('supplier', 'supplier'); $metals = Product::lists('metal', 'metal'); return View::make('products.list')->with('products', $products)->with('suppliers', $suppliers)->with('metals', $metals)->with('users', $users); }
public function getView($id) { $product = Product::find($id); if ($product) { $random = Product::all()->random(4); return View::make('store.view')->with('product', $product)->with('random', $random); } else { return View::make('404'); } }
public function getHome() { $products = Product::all(); if (Auth::check()) { $user = Auth::user(); } else { $user = new User(); $user->first_name = 'stranger'; } return View::make('home', array('products' => $products, 'user' => $user)); }
function getProducts() { $ProductID = $this->f3->get('PARAMS.ProductID'); $p = new Product($this->db); //$products = $product->all(); if (isset($ProductID)) { $products = $p->getById($ProductID); } else { $products = $p->all(); } echo $this->utils->successResponse($p, $products); }
public function run() { $this->trancate(); $languages = Language::all(); $products = Product::all(); $categories = Category::all(); $categories_array = $categories->toArray(); $products->each(function ($product) use($categories_array) { // product to categories DB::table('products_to_categories')->insert(array('product_id' => $product->id, 'category_id' => $categories_array[rand(0, count($categories_array) - 1)]['id'])); }); }
public function index() { // Check if user has sent a search query if ($query = Input::get('query', false)) { // Use the Elasticquent search method to search ElasticSearch $products = Product::search($query); } else { // Show all posts if no query is set $products = Product::all(); } return View::make('products', compact('products')); }
public function run() { $this->trancate(); $faker = Faker\Factory::create(); $products = Product::all(); $products->each(function ($product) use($faker) { //product reviews $reviews_count = rand(0, 30); for ($i = 0; $i < $reviews_count - 1; $i++) { DB::table('products_review')->insert(array('product_id' => $product->id, 'author' => $faker->firstName, 'title' => $faker->sentence, 'text' => $faker->text(), 'rating' => rand(1, 5), 'approved' => 1, 'created_at' => \Carbon\Carbon::createFromDate(rand(2012, 2014), rand(1, 12), rand(1, 29))->toDateTimeString(), 'updated_at' => \Carbon\Carbon::createFromDate(rand(2012, 2014), rand(1, 12), rand(1, 29))->toDateTimeString())); } }); }
public function get($id = null) { $search = Input::get('search'); if (!is_null($search)) { $adjustments = Adjustment::select('adjustments.*')->join('products', 'products.id', '=', 'adjustments.products_id')->where('products.name', 'like', '%' . $search . '%')->orwhere('products.code', 'like', '%' . $search . '%')->orderBy('adjustments.created_at')->paginate(15); } else { $adjustments = Adjustment::latest()->paginate(15); } $selectedAdjustment = self::__checkExistence($id); if (!$selectedAdjustment) { $selectedAdjustment = new Adjustment(); } $products = Product::all()->lists('name', 'id'); return View::make('adjustments.main')->with('id', $id)->with('products', $products)->with('search', $search)->with('selectedAdjustment', $selectedAdjustment)->with('adjustments', $adjustments); }
public function dashboard() { if (!Auth::user()->is_admin) { return Redirect::to('/'); } //produits de la boutique $products = Product::all(); // récupérer les dates ou il y a eu des commandes donc achats $cmds = DB::select(DB::raw('SELECT DATE(orders.date) AS date FROM orders GROUP BY DATE(orders.date) ORDER BY orders.date DESC')); //récupérer les achats par date $cmdsByDate = array(); foreach ($cmds as $key => $cmd) { $cmdsByDate[$cmd->date] = Orderitem::whereRaw('DATE(orders.date) = \'' . $cmd->date . '\'')->leftJoin('orders', 'order_items.order_id', '=', 'orders.id')->leftJoin('users', 'orders.user_id', '=', 'users.id')->leftJoin('products', 'order_items.item_id', '=', 'products.id')->select('order_items.*', 'orders.date AS date', 'users.email AS user_email', 'users.first_name AS user_first', 'users.last_name AS user_last', 'products.name AS item_name')->orderBy('orders.date', 'DESC')->get(); } //list des commandes par mois return View::make('admin/show', array('products' => $products, 'cmdsbydate' => $cmdsByDate)); }
public function run() { $faker = $this->getFaker(); $orders = Order::all(); $products = Product::all()->toArray(); foreach ($orders as $order) { $used = []; for ($i = 0; $i < rand(1, 5); $i++) { $product = $faker->randomElement($products); if (!in_array($product["id"], $used)) { $id = $product["id"]; $price = $product["price"]; $quantity = rand(1, 3); OrderItem::create(["order_id" => $order->id, "product_id" => $id, "price" => $price, "quantity" => $quantity]); $used[] = $product["id"]; } } } }
public function run() { $this->trancate(); $languages = Language::all(); $products = Product::all(); // insert attributes $doc = new DOMDocument(); $doc->load(app_path() . "/database/seed_data/attributes.xml"); $xpath = new DOMXPath($doc); foreach ($xpath->evaluate("/groups/group", $doc) as $element) { $attributes_group_id = DB::table('attributes_group')->insertGetId([]); foreach ($languages as $language) { DB::table('attributes_group_description')->insert(array('attribute_group_id' => $attributes_group_id, 'language_id' => $language->id, 'name' => $element->getAttribute('title-el'))); } foreach ($xpath->evaluate("attribute", $element) as $attr) { $attribute_id = DB::table('attributes')->insertGetId(['attribute_group_id' => $attributes_group_id, 'data_type' => $attr->getAttribute('data-type'), 'is_filterable' => true, 'is_variant' => false]); foreach ($languages as $language) { DB::table('attributes_options')->insert(array('attribute_id' => $attribute_id, 'language_id' => $language->id, 'options' => $attr->getAttribute('options-el'))); DB::table('attributes_description')->insert(array('attribute_id' => $attribute_id, 'language_id' => $language->id, 'name' => $attr->getAttribute('title-el'))); } } } }
/** * Show the form for creating a new resource. * GET /adminscompanyproduct/create * * @return Response */ public function create($provider_id) { $products = Product::all()->lists('name', 'id'); return View::make('provider.products.create', compact('provider_id', 'products')); }
/** * Show the form for creating a new resource. * GET /adminsprovider/create * * @return Response */ public function create() { $role = check_admin_auth(); $products = Product::all(); return View::make('providers.create', compact('role', 'products')); }
}); Route::get('xcat', function () { print_r(Prefs::getCategory()); }); Route::get('barcode/dl/{txt}', function ($txt) { $barcode = new Barcode(); $barcode->make($txt, 'code128', 60, 'horizontal', true); return $barcode->render('jpg', $txt, true); }); Route::get('barcode/{txt}', function ($txt) { $barcode = new Barcode(); $barcode->make($txt, 'code128', 60, 'horizontal', true); return $barcode->render('jpg', $txt); }); Route::get('media', function () { $media = Product::all(); print $media->toJson(); }); Route::get('login', function () { return View::make('login'); }); Route::post('login', function () { // validate the info, create rules for the inputs $rules = array('email' => 'required|email', 'password' => 'required|alphaNum|min:3'); // run the validation rules on the inputs from the form $validator = Validator::make(Input::all(), $rules); // if the validator fails, redirect back to the form if ($validator->fails()) { return Redirect::to('login')->withErrors($validator); } else { $userfield = Config::get('kickstart.user_field');
public function index() { // Get all products from the database $products = Product::all(); return View::make('product/product-list')->with('products', $products); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $data['products'] = Product::all(); return View::make('products.index', $data); }
public function welcome() { $categories = Category::all(); $products = Product::all(); return View::make('admin.index', compact('categories'))->withProducts($products); }
public function getIndex() { $categories = Category::lists('name', 'id'); return View::make('products.index')->with('products', Product::all())->with(compact('categories')); }
public function index() { $products = Product::all(); return View::make('dashboard.products.index', ['products' => $products]); }
public function getIndex() { $data = array('product' => Product::all()); return View::make('index', $data); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $products = $this->product->all(); return View::make('products.index', compact('products')); }
public function all() { $products = Product::all(); return View::make('products/all', array('products' => $products)); }
Route::get('erpmgmt', function () { return View::make('erpmgmt'); }); Route::get('cbsmgmt', function () { if (Confide::user()->user_type == 'admin') { $members = Member::all(); //print_r($members); return View::make('cbsmgmt', compact('members')); } if (Confide::user()->user_type == 'teller') { $members = Member::all(); return View::make('tellers.dashboard', compact('members')); } if (Confide::user()->user_type == 'member') { $loans = Loanproduct::all(); $products = Product::all(); $rproducts = Product::getRemoteProducts(); return View::make('shop.index', compact('loans', 'products', 'rproducts')); } }); /* * ##################################################################################################################### */ Route::get('import', function () { return View::make('import'); }); Route::get('automated/loans', function () { $loanproducts = Loanproduct::all(); return View::make('autoloans', compact('loanproducts')); }); Route::get('automated/savings', function () {
public function index() { return View::make("admin.shop.product.index", ['items' => Product::all(), 'name' => $this->name, 'action' => $this->action]); }