/** * Bind data to the view. * * @param View $view */ public function compose(View $view) { $products = Product::allLists(); $shopkeepers = User::searchShopkeepers(); $communes = ['1' => 'Comuna 1', '2' => 'Comuna 2', '3' => 'Comuna 3', '4' => 'Comuna 4', '5' => 'Comuna 5', '6' => 'Comuna 6', '7' => 'Comuna 7', '8' => 'Comuna 8']; $view->with(['communes' => $communes, 'products' => $products, 'shopkeepers' => $shopkeepers]); }
/** * Bind data to the view. * * @param View $view */ public function compose(View $view) { Session::updateCurrent(); $sessions = Session::registered()->withUserMessages()->where('user_id', '<>', Auth::user()->id)->get(); $offlineUsers = User::getOfflineWithMessages(); $user = Auth::user(); $view->with(['sessions' => $sessions, 'user' => $user, 'offlineUsers' => $offlineUsers]); }
public function run() { $count = 5001; foreach ($this->producers as $producer) { try { User::create(['name' => $producer['name'], 'doc' => $producer['doc'], 'tel' => $producer['tel'], 'username' => $producer['tel'] ? $producer['tel'] : $count, 'password' => 123, 'type' => 'producer', 'municipality_id' => 685, 'email' => null]); if (!$producer['tel']) { $count++; } } catch (QueryException $e) { } } }
public function run() { $count = 6001; foreach ($this->shopkeepers as $shopkeeper) { try { $user = User::create(['name' => $shopkeeper['name'], 'tel' => $shopkeeper['tel'], 'address' => $shopkeeper['address'], 'commune' => $shopkeeper['commune'], 'username' => $shopkeeper['tel'] ? $shopkeeper['tel'] : $count, 'password' => 123, 'type' => 'shopkeeper', 'municipality_id' => 685, 'email' => null]); if (!$shopkeeper['tel']) { $count++; } ShoppingInterest::create(['product_id' => 1, 'user_id' => $user->id, 'amount' => $shopkeeper['papa'], 'unit' => 'kg']); ShoppingInterest::create(['product_id' => 2, 'user_id' => $user->id, 'amount' => $shopkeeper['yuca'], 'unit' => 'kg']); ShoppingInterest::create(['product_id' => 3, 'user_id' => $user->id, 'amount' => $shopkeeper['arracacha'], 'unit' => 'kg']); ShoppingInterest::create(['product_id' => 7, 'user_id' => $user->id, 'amount' => $shopkeeper['platano'], 'unit' => 'kg']); ShoppingInterest::create(['product_id' => 11, 'user_id' => $user->id, 'amount' => $shopkeeper['hortalizas'], 'unit' => 'kg']); ShoppingInterest::create(['product_id' => 20, 'user_id' => $user->id, 'amount' => $shopkeeper['frutas'], 'unit' => 'kg']); } catch (QueryException $e) { } } }
public function getCommuneStatistics() { $communes = User::notAdmins()->select('commune', 'type', \DB::raw('COUNT(*) as total'))->groupBy('commune', 'type')->orderBy('commune', 'asc')->get()->groupBy('commune'); $stat = ['content' => [['label' => 'Número de tenderos', 'data' => []], ['label' => 'Número de productores', 'data' => []]], 'names' => []]; $count = 0; foreach ($communes as $commune => $types) { foreach ($types as $type) { if ($type->type == 'shopkeeper') { array_push($stat['content'][0]['data'], [$count + 1, $type->total]); } else { array_push($stat['content'][1]['data'], [$count + 2, $type->total]); } } if ($types->count() < 2) { if ($types->first()->type == 'producer') { array_push($stat['content'][0]['data'], [$count + 1, 1]); } else { array_push($stat['content'][1]['data'], [$count + 2, 1]); } } if ($commune > 0) { array_push($stat['names'], [$count + 2, 'Comuna ' . $commune]); } else { array_push($stat['names'], [$count + 2, 'Fuera de Villavicencio']); } $count += 2.5; } return $stat; }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create($data); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $producers = User::notAdmins()->orderBy('name')->paginate(20); $this->form_data = ['route' => self::$prefixRoute . 'store', 'method' => 'POST']; return $this->getFormView('lists', ['producers' => $producers]); }
public function index() { $shopkeepers = User::shopkeepers()->get(); return view('stats.home', compact('shopkeepers')); }
public function stats() { $shopkeepers = User::shopkeepers()->get(); return view('dashboard.pages.admin.stats', compact('shopkeepers')); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $shopkeepers = User::paginate(20); $this->form_data = ['route' => self::$prefixRoute . 'store', 'method' => 'POST']; return $this->getFormView('lists', ['shopkeepers' => $shopkeepers]); }
/** * Bind data to the view. * * @param View $view */ public function compose(View $view) { $producers = User::with(['productions.product', 'municipality'])->producers()->orderBy('created_at')->take(60)->get(); $products = Auth::user()->shoppingInterestsLists(); $view->with(['producers' => $producers, 'products' => $products]); }
/** * Find the User or App Abort 404. */ public function findUser(Route $route) { $this->shopkeeper = User::findOrFail($route->getParameter('shopkeepers')); }