/** * Show the application dashboard to the user. * * @return Response */ public function index() { $new_so = Saleorder::where('status','=','0')->count(); $new_rso = ReturnSaleorder::where('status','=','0')->count(); $new_po = Purchaseorder::where('status','=','0')->count(); $new_rpo = ReturnPurchaseorder::where('status','=','0')->count(); $tong_san_pham = Product::count(); $begin = date('Y-m-d H:i:s',strtotime(date('d-m-Y'))); $end = date('Y-m-d H:i:s',strtotime(date('d-m-Y'))-15*86400); $doanh_so = Saleorder::addSelect(\DB::raw('sum(sum_amount) as y')) ->addSelect(\DB::raw('Date(date) as x')) ->where('status',1) ->groupBy('x') ->orderBy('x','desc') ->limit(7) ->get()->toArray(); $arr_x = array(); foreach ($doanh_so as $key => $value) { $arr_x[] = $value['x']; $doanh_so[$key]['x'] = date('m-d-Y',strtotime($value['x'])); } array_multisort($arr_x,SORT_ASC,$doanh_so); $doanh_so = json_encode($doanh_so); $this->layout->content = view('dashboard.dashboard',[ 'new_so' => $new_so, 'new_rso' => $new_rso, 'new_po' => $new_po, 'new_rpo' => $new_rpo, 'tong_san_pham'=> $tong_san_pham, 'doanh_so' => $doanh_so ]); }
public function __construct() { $variable2 = Product::count(); View::share('variable1', $this->variable1); View::share('variable2', $variable2); View::share('variable3', 'I am Data 3'); View::share('variable4', ['name' => 'Franky']); }
public function index() { \App\Gini\Gapper\Client::init(); if (\App\Gini\Gapper\Client::getUserName()) { return view('dashboard', ['products_count' => Product::count(), 'servers_count' => Server::count(), 'clients_count' => Client::where('parent_id', 0)->count(), 'projects_count' => Project::count()]); } return view('login'); }
public function run() { $faker = Faker::create(); $categoriesIds = Category::lists('id')->all(); $ProductsIds = Product::lists('id')->all(); foreach (range(1, Product::count()) as $index) { DB::table('category_product')->insert(['category_id' => $faker->randomElement($categoriesIds), 'product_id' => $index]); } }
public function index() { $count_hodon = Hoadon::count(); $count_sanpham = Product::count(); $count_danhgia = Danhgia::count(); $product = Product::orderBy('id', 'DESC')->take(3)->get()->toArray(); $donhang = Hoadon::orderBy('id', 'DESC')->take(4)->get(); return view('backend.home', compact('count_hodon', 'count_sanpham', 'count_danhgia', 'product', 'donhang')); }
public function adminDashboard() { $page = 'partials.admin-dashboard'; $users = User::all(); $user_count = User::count(); $product_count = Product::count(); $brand_count = Brand::count(); $type_count = Type::count(); return view('quantri/admin', compact('page', 'users', 'user_count', 'product_count', 'brand_count', 'type_count')); }
/** * Execute the console command. * * @return mixed */ public function handle() { $raw = array_map('str_getcsv', file('data.csv')); $data = array_slice($raw, 1); foreach ($data as $row) { $location = Location::firstOrCreate(['county' => $this->county($row[0]), 'city' => $this->city($row[1]), 'state' => $this->state($row[0])]); $product = Product::create(['name' => $row[2], 'freight' => $this->float($row[4]), 'margin' => $this->float($row[5]), 'delivered_price' => $this->float($row[6]), 'location_id' => $location->id]); } $this->info(sprintf("Imported %d locations and %d products\r", Location::count(), Product::count())); }
/** * Execute the console command. * * @return mixed */ public function handle() { $this->comment(sprintf("Deleting %d products and %d locations", Product::count(), Location::count())); Product::all()->each(function ($doc) { $doc->delete(); }); Location::all()->each(function ($doc) { $doc->delete(); }); }
public function view_products() { $data = []; if (Product::count() > 0) { $data['results'] = Product::orderBy('caption', 'asc')->get(); return response()->json($data, 200); } else { $data['results'] = "No data fund"; return response()->json($data, 404); } }
public function getList(Request $request, $type = 'all') { $perpage = 20; $products = Product::orderBy('product_type', 'ASC')->orderBy('product_sort', 'ASC'); $allCount = Product::count(); $onlineCount = Product::where('product_active', '=', '1')->count(); $offlineCount = Product::where('product_active', '=', '0')->count(); if ($type == 'online') { $products = $products->where('product_active', '=', '1'); } elseif ($type == 'offline') { $products = $products->where('product_active', '=', '0'); } $products = $products->paginate($perpage); session(['previousUrl' => URL::full()]); return view('manage.product.list', ['TITLE' => '产品列表', 'META_KEYWORDS' => META_KEYWORDS, 'META_DESC' => META_DESC, 'PAGE_CODE' => '/manage/product/list', 'type' => $type, 'products' => $products, 'allCount' => $allCount, 'onlineCount' => $onlineCount, 'offlineCount' => $offlineCount]); }
public function index() { $dataView = ['productsCount' => Product::count(), 'plansCount' => Plan::where('month', \Config::get('app.current_month'))->count(), 'reportsCount' => Report::where('month', \Config::get('app.current_month'))->count(), 'customersCount' => Customer::count(), 'employeesCount' => Employee::count()]; return view('admin.index', $dataView); }
public function index() { $username = Auth::user()->name; $data = array('users' => App\Users::count(), 'products' => App\Product::count(), 'orders' => App\Order::count(), 'producers' => App\Producer::count()); return view('admin.dashboard.index', compact('data'))->with(['username' => $username]); }
public function about_us_data($domain) { $gen = Gen::getCurrentGen(); $classes = $gen->studyclasses()->where('name', 'like', '%.%')->count(); $student = Register::where('code', '!=', null)->count() + 2000; $posts = Product::count() + 4000; return $this->respond(['gen' => ['name' => $gen->name, 'detail' => $gen->detail], 'studentsNumber' => $student, 'classesNumber' => $classes, 'postsNumber' => $posts]); }