
PK 
<?php
namespace App\Http\Controllers;
use App\Dashboard;
use Illuminate\Http\Request;
use Carbon\Carbon;
class DashboardController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth:admin');
}
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$dt = Carbon::now();
// echo $yesterday = Carbon::yesterday()->date();
$fromdate = $dt->subDays(5)->toDateString();
$todate=Carbon::now()->toDateString();
$user_registraint= \App\User::count();
$recent_order= \App\OrderManage::where('order_status','1')->whereBetween('created_at', array($fromdate, $todate))->count();
$user_subscriber= \App\Subscriber::count();
$product_count= \App\Product::count();
//p($user_registraint);
$arrayObj =['user_registraint'=>$user_registraint,'recent_order'=>$recent_order,'user_subscriber'=>$user_subscriber,'product_count'=>$product_count];
$data = arrayToObject($arrayObj);
return view('backend.admin.dashboard',compact('data'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param \App\Dashboard $dashboard
* @return \Illuminate\Http\Response
*/
public function show(Dashboard $dashboard)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Dashboard $dashboard
* @return \Illuminate\Http\Response
*/
public function edit(Dashboard $dashboard)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Dashboard $dashboard
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Dashboard $dashboard)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param \App\Dashboard $dashboard
* @return \Illuminate\Http\Response
*/
public function destroy(Dashboard $dashboard)
{
//
}
}


PK 99