Skip to content

Instantly share code, notes, and snippets.

@djaiss
Last active November 17, 2023 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djaiss/d90ddf7ab3d675b2b2240daf898dfef8 to your computer and use it in GitHub Desktop.
Save djaiss/d90ddf7ab3d675b2b2240daf898dfef8 to your computer and use it in GitHub Desktop.
Laravel flash notification with alpine which hide after a while
@if (session('error'))
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 3000)" class="pt-6 mx-auto max-w-xl px-2 sm:px-6 lg:px-8">
<div class="flex items-center overflow-hidden border border-red-200 bg-white shadow-sm dark:bg-gray-800 rounded sm:rounded-lg">
<div class="px-2 py-2 bg-orange-100 mr-2">
<x-heroicon-o-light-bulb class="h-5 w-5 text-red-500" />
</div>
<p>{{ session('error') }}</p>
</div>
</div>
@endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment