Commit 2aaf96ae authored by Sylvain's avatar Sylvain

Mise à jour des helpers

parent 3f28dfad
...@@ -5,14 +5,14 @@ use Illuminate\Support\Collection; ...@@ -5,14 +5,14 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Str; use Illuminate\Support\Str;
if ( !function_exists('increasePercent')) { if ( !function_exists('calc_percent')) {
/** /**
* Calcul le pourcentage d'accroissement entre 2 valeurs * Calcul le pourcentage d'accroissement entre 2 valeurs
* @param int|float $old_value * @param int|float $old_value
* @param int|float $new_value * @param int|float $new_value
* @return float La valeur d'accroissement * @return float La valeur d'accroissement
*/ */
function calcPercent($old_value, $new_value) function calc_percent($old_value, $new_value)
{ {
if ($new_value == 0) { if ($new_value == 0) {
return 0; return 0;
......
...@@ -13,7 +13,7 @@ if ( !function_exists('published_html')) { ...@@ -13,7 +13,7 @@ if ( !function_exists('published_html')) {
function published_html($status) function published_html($status)
{ {
$html = ''; $html = '';
if ($status == 1) { if ($status == 1 || $status == true) {
$html = '<i class="fa fa-globe text-success"></i>'; $html = '<i class="fa fa-globe text-success"></i>';
} else { } else {
$html = '<i class="fa fa-eye-slash text-warning"></i>'; $html = '<i class="fa fa-eye-slash text-warning"></i>';
......
...@@ -4,6 +4,7 @@ use Illuminate\Support\HtmlString; ...@@ -4,6 +4,7 @@ use Illuminate\Support\HtmlString;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Str; use Illuminate\Support\Str;
if ( !function_exists('col_sort')) { if ( !function_exists('col_sort')) {
/** /**
* Affiche un icon de tri de colonne dans une vue tableau * Affiche un icon de tri de colonne dans une vue tableau
......
...@@ -3,13 +3,14 @@ ...@@ -3,13 +3,14 @@
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use Illuminate\Support\Facades\Request;
if ( !function_exists('get_request_query')) { if ( !function_exists('get_query_string')) {
/** /**
* Retourne un tableau avec les paramètres de l'url courante * Retourne un tableau avec les paramètres de l'url courante
* @return array Un tableau contenant les paramètres * @return array Un tableau contenant les paramètres
*/ */
function get_request_query() function get_query_string()
{ {
parse_str(Request::getQueryString(), $array); parse_str(Request::getQueryString(), $array);
...@@ -25,7 +26,7 @@ if (! function_exists('str_current_query')) { ...@@ -25,7 +26,7 @@ if (! function_exists('str_current_query')) {
*/ */
function str_current_query() : string function str_current_query() : string
{ {
$queries = array_filter(get_request_query()); $queries = array_filter(get_query_string());
return http_build_query($queries); return http_build_query($queries);
} }
} }
...@@ -36,7 +37,7 @@ if (! function_exists('current_route_belongs')) { ...@@ -36,7 +37,7 @@ if (! function_exists('current_route_belongs')) {
* @param string La route à tester * @param string La route à tester
* @return string * @return string
*/ */
function belongs_route($route_name) : string function current_route_belongs($route_name) : string
{ {
$route = route($route_name, [], false); $route = route($route_name, [], false);
$uri = trim($route, '/'); $uri = trim($route, '/');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment