-
app/Helpers/CustomHelper.php
Open in GitHubfunction isAlertDismissed(string $id): bool { return isset($_COOKIE['alert-dismiss-' . $id]); } //
-
resources/views/common/general/alert.blade.php
Open in GitHub<?php $name = $name ?? 'default'; $type = $type ?? ''; $dismiss = $dismiss ?? true; $rootClass = $rootClass ?? ''; ?> @if(!isAlertDismissed($name)) <div class="alert alert-{{ $type }} text-center mt-4 {{ $dismiss ? 'alert-dismissable' : '' }} {{ $rootClass }}" role="alert"> @if($dismiss) <a href="#" class="close" data-dismiss="alert" aria-label="close" data-alert-dismiss-id="{{ $name }}"> <i class="fas fa-times"></i> </a> @endif @if($type === 'info') <i class="fas fa-info-circle"></i> @elseif($type === 'warning') <i class="fa fa-exclamation-triangle"></i> @endif {{ $slot }} </div> @endif
-
app/Providers/HelperServiceProvider.php
Open in GitHubuse Illuminate\Support\ServiceProvider; class HelperServiceProvider extends ServiceProvider { public function register() { require_once app_path('Helpers/CustomHelper.php'); } // }
-
config/app.php
Open in GitHubreturn [ 'providers' => [ // App\Providers\HelperServiceProvider::class, // ], ];