Skip to content
Emeka Mbah edited this page Sep 30, 2024 · 5 revisions

Installation

1. Install Alert with composer:

composer require digitlimit/alert

2. Publish the config file and views if necessary

 php artisan vendor:publish --provider="Digitlimit\Alert\AlertServiceProvider"

3. Somewhere in the blade template

<x-alert-message />

Example:

@extends('layouts.default')

@section('content')
  <div class="container-xxl flex-grow-1 container-p-y">
    <div class="row">
      <div class="col-md-12">
        <x-alert-message />
      </div>
    </div>

    <div class="row">
      @include('form.profile')
    </div>        
  </div>

  @include('partials.footer')
@endsection

NB: Currently, the alert components are built with Twitter Bootstrap 5, and can be customized to use other CSS classes. We need to ensure Bootstrap is included on the page.

4. Somewhere in the application

<?php

namespace App\Http\Controllers;

use Alert;

class DashboardController extends Controller
{
    public function index()
    {
        Alert::message('Welcome! Please complete your profile')
            ->info()
            ->flash();

        return view('home');
    }
}

5. Result

image

Clone this wiki locally