本文整理汇总了PHP中app\Product::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::count方法的具体用法?PHP Product::count怎么用?PHP Product::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Product
的用法示例。
在下文中一共展示了Product::count方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* 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
]);
}
示例2: __construct
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']);
}
示例3: index
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');
}
示例4: run
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]);
}
}
示例5: 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'));
}
示例6: adminDashboard
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'));
}
示例7: handle
/**
* 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()));
}
示例8: handle
/**
* 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();
});
}
示例9: view_products
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);
}
}
示例10: getList
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]);
}
示例11: index
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);
}
示例12: index
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]);
}
示例13: about_us_data
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]);
}