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();
}