Skip to content

awalhadi/laravel-toastr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Toastr Package

Laravel Toastr is a simple and elegant notification package for Laravel applications. It integrates the popular Toastr.js library, allowing you to display stylish and customizable toast notifications in your Laravel project with minimal effort.

Table of Contents

  • Installation
  • Configuration
  • Usage
  • Customization
  • Contributing
  • License

Installation

  1. Install the Package

    Run the following command to install the package:
composer require awalhadi/laravel-toastr
  1. Publish Assets and Configuration (Optional)

    If you want to customize the default configuration, you can publish the assets and configuration file:
php artisan vendor:publish --provider="AwalHadi\LaravelToastr\ToastrServiceProvider"

Configuration

After publishing, you can customize the Toastr options by editing the config/toastr.php file.

Usage

In Controllers

Use the Toastr facade to add Toastr notifications in your controllers:

use Toastr;

public function updateProfile(Request $request)
{
    // Update the user's profile...

    Toastr::showSuccess('Profile updated successfully!');

    return redirect()->route('profile');
}

In Views

Include the Toastr assets and display the notifications by using the** @h_toastr** directive in your Blade views:

<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Other head elements... -->
  </head>
  <body>
    <!-- Body elements... -->
    @h_toastr
  </body>
</html>

Customization

You can customize the appearance and behavior of the Toastr notifications by editing the config/toastr.php file.

Contributing

Contributions are welcome! Please read the contributing guide to learn how to contribute to this project.

License

Laravel Toastr is open-sourced software licensed under the MIT license.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published