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

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Http\Services\SupportiveService;
use App\Http\Requests\Supportives\SupportiveListRequest;
use App\Http\Requests\Supportives\SupportiveCreateRequest;
use App\Http\Requests\Supportives\SupportiveUpdateRequest;
use App\Http\Requests\IdOnlyRequest;
use App\Models\Supportive;
use Auth;

class SupportiveController extends Controller
{
	public function __construct(
		SupportiveService $supportiveService
	)
	{
		$this->supportiveService = $supportiveService;
	}

	/**
	* @OA\Get(
	*
	*	path="/api/supportive/list/{type}",
	*	operationId="get supportive",
	*	tags={"Supportive"},
	*	summary="Get supportive",
	*	security={
	*		{
	*			"open_key": {}
	*		},
	*		{
	*			"api_key": {}
	*		}
	*	},
	*	@OA\Parameter(
	*		name="type",
	*		description="type",
	*		in="path",
	*		@OA\Schema(
	*			type="enum",
	*			default="tnc",
	*			enum={"tnc", "delivery-tnc", "locker-overdue","about-us", "faq", "refund-policy", "privacy-policy", "value-declaration"}
	*		)
	*	),
	*	@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 supportiveList(SupportiveListRequest $request)
	{
		$payload = $request->validated();
		$payload['type_id'] = array_search($payload['type'], Supportive::TYPES);
		if(!Auth::user()->isSuperAdmin()){
			unset($payload['activity']);
		}

		$supportives = $this->supportiveService->supportiveList( $payload );

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

	public function supportiveCreate(SupportiveCreateRequest $request)
	{
		$payload = $request->validated();
		$payload['type_id'] = array_search($payload['type'], Supportive::TYPES);

		$supportive = $this->supportiveService->supportiveCreate( $payload );

		return self::successResponse('Success',$supportive);
	}
	
	public function supportiveUpdate(SupportiveUpdateRequest $request)
	{
		$payload = $request->validated();
		$payload['type_id'] = array_search($payload['type'], Supportive::TYPES);

		if( in_array($payload['type_id'], [Supportive::TNC, Supportive::DELIVERY_TNC, Supportive::ABOUT_US, Supportive::REFUND_POLICY, Supportive::PRIVACY_POLICY, Supportive::LOCKER_OVERDUE, Supportive::VALUE_DECLARATION] ) ){
			$supportive = $this->supportiveService->supportiveUpdateOrCreate( $payload );
		}else{
			$supportive = $this->supportiveService->supportiveUpdate( $payload );
		}

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

	public function supportiveDelete(IdOnlyRequest $request)
	{
		$supportive = $this->supportiveService->supportiveDelete( $request->validated() );

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

}

Youez - 2016 - github.com/yon3zu
LinuXploit