Skip to content

Instantly share code, notes, and snippets.

@aytacmalkoc
Last active May 20, 2025 08:33
Show Gist options
  • Save aytacmalkoc/a125dd5771a17e2c1c1e9aa34496f252 to your computer and use it in GitHub Desktop.
Save aytacmalkoc/a125dd5771a17e2c1c1e9aa34496f252 to your computer and use it in GitHub Desktop.

Revisions

  1. aytacmalkoc revised this gist May 20, 2025. 1 changed file with 27 additions and 0 deletions.
    27 changes: 27 additions & 0 deletions helpers.php
    Original file line number Diff line number Diff line change
    @@ -16,4 +16,31 @@ function route_with_query($name, $parameters = [], $absolute = true): string
    {
    return route($name, [request()->getQueryString(), ...$parameters], $absolute);
    }
    }

    if (!function_exists('get_hours_24_format')) {
    function get_hours_24_format(): array
    {
    $hours = [];

    for ($i = 0; $i < 24; $i++) {
    $hours[] = str_pad($i, 2, '0', STR_PAD_LEFT) . ':00';
    }

    return $hours;
    }
    }

    if (!function_exists('greeting')) {
    function greeting(): string
    {
    $hour = \Illuminate\Support\Carbon::now()->hour;

    return match (true) {
    $hour >= 6 && $hour < 12 => "🌥️ Günaydın",
    $hour >= 12 && $hour < 18 => "😎 İyi günler",
    $hour >= 18 && $hour < 23 => "🌚 İyi akşamlar",
    $hour >= 23 || $hour < 6 => "🌜 İyi geceler"
    };
    }
    }
  2. aytacmalkoc revised this gist Jan 12, 2025. No changes.
  3. aytacmalkoc revised this gist Jan 12, 2025. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions helpers.php
    Original file line number Diff line number Diff line change
    @@ -10,3 +10,10 @@ function route_is(string|array $routeNames): bool
    return collect($routeNames)->contains(fn($routeName) => \Illuminate\Support\Str::is($routeName, $currentRoute));
    }
    }

    if (!function_exists('route_with_query')) {
    function route_with_query($name, $parameters = [], $absolute = true): string
    {
    return route($name, [request()->getQueryString(), ...$parameters], $absolute);
    }
    }
  4. aytacmalkoc revised this gist Jun 27, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion helpers.php
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    if (!function_exists('route_is')) {
    function route_is(string|array $routeNames): bool
    {
    $currentRoute = Route::currentRouteName();
    $currentRoute = \Illuminate\Support\Facades\Route::currentRouteName();

    $routeNames = (array) $routeNames;

  5. aytacmalkoc created this gist Jun 27, 2024.
    12 changes: 12 additions & 0 deletions helpers.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    <?php

    if (!function_exists('route_is')) {
    function route_is(string|array $routeNames): bool
    {
    $currentRoute = Route::currentRouteName();

    $routeNames = (array) $routeNames;

    return collect($routeNames)->contains(fn($routeName) => \Illuminate\Support\Str::is($routeName, $currentRoute));
    }
    }