HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/MdnDirecteur/hours.komma.cloud/app/helpers.php
<?php

/*
|--------------------------------------------------------------------------
| Detect Active Route
|--------------------------------------------------------------------------
|
| Compare given route with current route and return output if they match.
| Very useful for navigation, marking if the link is active.
|
*/
function isActiveRoute($route, $output = "active")
{
    $currentRoute = !empty(\Request::route()) ? \Request::route()->uri() : "";
    if (strpos($currentRoute, $route) !== false) return $output;
}

function isRoute($route)
{
    return Route::currentRouteName() == $route;
}

/*
|--------------------------------------------------------------------------
| Detect Active Routes
|--------------------------------------------------------------------------
|
| Compare given routes with current route and return output if they match.
| Very useful for navigation, marking if the link is active.
|
*/
function areActiveRoutes(Array $routes, $output = "active")
{
    foreach ($routes as $route)
    {
        if (Route::currentRouteName() == $route) return $output;
    }

}


/**
 * @param $collection
 * @return mixed
 */
function sortByColumn($collection, $column, $column2)
{
    //sort by date and return
    return $sorted = $collection->sortBy(function ($col) use ($column, $column2) {
        return sprintf('%-12s%s', $col[$column], $col[$column2]);
    })->values()->all();
}