403Webshell
Server IP : 34.87.99.72  /  Your IP : 216.73.217.31
Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n
System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64
User : bitnami ( 1000)
PHP Version : 7.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/bitnami/apache/htdocs/app/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/bitnami/apache/htdocs/app/app/Http/Controllers/DashboardController.php
<?php

namespace App\Http\Controllers;

use App\Http\Services\BoxInventoryService;
use App\Http\Services\NotificationService;
use App\Http\Services\PromotionService;
use App\Http\Services\LockerBoardService;
use Auth;
use Illuminate\Http\Request;

class DashboardController extends Controller
{
	public function __construct(
		BoxInventoryService $boxInventoryService,
		NotificationService $notificationService,
		PromotionService $promotionService,
		LockerBoardService $lockerBoardService
	)
	{
		$this->boxInventoryService = $boxInventoryService;
		$this->notificationService = $notificationService;
		$this->promotionService = $promotionService;
		$this->lockerBoardService = $lockerBoardService;
	}

	/**
	* @OA\Get(
	*
	*	path="/api/dashboard",
	*	operationId="getDashboard",
	*	tags={"Dashboard"},
	*	summary="getDashboard",
	*	security={
	*		{
	*			"open_key": {}
	*		},
	*		{
	*			"api_key": {}
	*		}
	*	},
	*	@OA\Response(
	*		response=200,
	*		description="Success",
	*		@OA\JsonContent()
	*	),
	*	@OA\Response(response=400, description="Bad request"),
	*	@OA\Response(response=404, description="Resource Not Found"),
	*	@OA\Response(response=422, description="Unprocessable Entity"),
	*	@OA\Response(response=500, description="Internal Server Error"),
	* )
	*/
	public function getDashboard(Request $request) {

		$user = Auth::user();
		// $user = \App\Models\User::find(3); // for debug uses

		if($user->isCustomer()){

			$boxInventorys = $this->boxInventoryService->boxInventoryList([
					'user_uncollected' => $user->id,
					'or_collector_num_uncollected' => $user->mobile_num,
					'itemsPerPage' => 5,
				]);
			// manual compute
			$boxInventorys->each(function($item, $key) use ($user){
				$item->getInventoryType($user);
			});
			$boxInventorys->append('inventory_type');

			$promotions = $this->promotionService->listPromotion([
				'has_image' => true,
				'is_ongoing' => true,
				'itemsPerPage' => 5,
			]);

			return self::successResponse("Success", [
				"total_credit" => $user->getCreditAmount(),
				"user" => $user,
				"on_going_activities" => $boxInventorys->values(),
				"has_more_on_going" => $boxInventorys->hasMorePages(),
				"active_promotions" => $promotions->values(),
				"has_more_promotions" => $promotions->hasMorePages(),
				"has_unseen_notification" => $this->notificationService->hasUnseenNotification($user),
				"number_unseen_notification" => $this->notificationService->hasUnseenNotification($user, false),
			]);
		}else if($user->isSuperAdmin()){
			$aa = $this->lockerBoardService->decodeAllLockerStatus($request->test);

			return self::successResponse("Success", join(", ", $aa));
			// return self::successResponse("Success", $aa);
			return self::successResponse("Success", "Welcome to Admin Panel");
		}

		return self::successResponse("Success", null);

	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit