承接 ab01faz101/tail-alert 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ab01faz101/tail-alert

最新稳定版本:v3.0.0

Composer 安装命令:

composer require ab01faz101/tail-alert

包简介

A lightweight and responsive alert package for Laravel Livewire, built with Tailwind CSS.

README 文档

README

Tail Alert Logo

Tail Alert - Livewire Toast Notifications 🚀

Packagist Version Downloads License

Tail Alert is a lightweight Livewire alert package for Laravel, providing stylish toast notifications built with Tailwind CSS. It helps you display modern notifications easily in any Livewire component.

📦 Installation & Links

🚀 Why Use Tail Alert?

  • No need for extra JavaScript libraries
  • Works seamlessly with Livewire
  • Uses Tailwind CSS for modern designs
  • Lightweight and fast 🚀

Features

✔ Modern and minimal design with Tailwind
✔ Fully compatible with Livewire
✔ Supports different alert types (success, warning, error, info)

Preview

Tail Alert Preview Tail Alert Preview

🛠️ Installation

You can install the package via composer:

composer require ab01faz101/tail-alert
 php artisan vendor:publish --provider="Ab01faz101\TailAlert\TailAlertServiceProvider" --force

Add the following codes to your custom style or app.css.

@source '../../public/vendor/tail_alert/alert.js"';

.tail_alert_item.active{
    animation: tail_alert_item_move .4s;
}

.tail_alert_item.active .tail_alert_time_animation{
    margin: 0!important;
    animation: fullWidthAnimate 5s ease;
}



@keyframes fullWidthAnimate {
    0%{
        width: 0;
    }
    100%{
        width: 100%;
    }
}

@keyframes tail_alert_item_move {
    0%{
        transform: translateX(100%);
    }
    100%{
        transform: translateX(0);
    }
}

Next, add the scripts component to your template after the @livewireScripts.

<script src="{{ asset('vendor/tail_alert/alert.js') }}"></script>

Add this line of code to your Livewire component.

@include('components.alerts')

Note: This package requires Tailwind CSS to be installed in your project.

🔔 Usage

You can use Tail Alert by using the AlertTrait trait.

use Ab01faz101\TailAlert\Traits\TailAlertTrait;
 
class Index extends Component
{
    use TailAlertTrait;
    
    public function submit()
    {
        $this->alert('success', 'Basic Alert');
    }
}

In your Livewire component, you can trigger an alert like this:

$this->alert('success', 'alert message'  , "description");
$this->alert('info', 'alert message'  , "description");
$this->alert('warning', 'alert message' , "description");
$this->alert('error', 'alert message'  , "description");

public function flashSuccess() {
    session()->flash('alert', [
        'type' => 'success',
        'message' => 'Successful Operation!'
    ]);
}

public function flashError() {
    session()->flash('alert', [
        'type' => 'error',
        'message' => 'An Error Occurred.'
    ]);
}

public function flashWarning() {
    session()->flash('alert', [
        'type' => 'warning',
        'message' => 'Warning.'
    ]);
}

public function flashInfo() {
    session()->flash('alert', [
        'type' => 'info',
        'message' => 'Information.'
    ]);
}
public function redirectAlert() {
    return redirect()->route('test')->with('alert' , [
        'type' => 'success',
        'message' => 'mission successfully!'
    ]);
}

💡 The type can be success, error, warning, or info.

🔍 Keywords

Livewire Toast Notifications, Laravel Alerts, Tailwind CSS Alerts, Livewire Notifications, Laravel Toast

License

This package is released under the MIT License.

统计信息

  • 总下载量: 76
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 13
  • Watchers: 1
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-07