added stat
This commit is contained in:
@@ -17,9 +17,37 @@ use Illuminate\Support\Facades\Storage;
|
||||
class UserController extends Controller {
|
||||
|
||||
public function index(){
|
||||
$m = new UserModel;
|
||||
$userRole = Auth::user()->role;
|
||||
|
||||
if($userRole == "store_owner"){
|
||||
$storeId = Auth::user()->store_id;
|
||||
|
||||
$countStoreOrder = $m->countStoreOrder($storeId);
|
||||
$storeIncome = $m->storeIncome($storeId);
|
||||
$countStoreProduct = $m->countStoreProduct($storeId);
|
||||
$countStorePublishedProduct = $m->countStorePublishedProduct($storeId);
|
||||
|
||||
$post_data = array(
|
||||
'isStoreOwner' => true,
|
||||
'store_order' => $countStoreOrder[0]->count_order,
|
||||
'store_income' => $storeIncome[0]->store_income,
|
||||
'store_product_count' => $countStoreProduct[0]->store_product_count,
|
||||
'store_published_product' => $countStorePublishedProduct[0]->store_published_product
|
||||
);
|
||||
}else{
|
||||
$post_data = array(
|
||||
'isStoreOwner' => false,
|
||||
'store_order' => "",
|
||||
'store_income' => "",
|
||||
'store_product_count' => "",
|
||||
'store_published_product' => ""
|
||||
);
|
||||
}
|
||||
|
||||
// $post_data = json_encode($post_data, JSON_FORCE_OBJECT);
|
||||
return view('user-layouts.index')->with('data', $post_data);
|
||||
|
||||
return view('user-layouts.index');
|
||||
|
||||
}
|
||||
|
||||
public function addressBook(){
|
||||
|
||||
Reference in New Issue
Block a user