- Laravel
- Laravel Elixir
- VueJS
- Laravel-Elixir-Vueify
- Run the following command from your project root:
composer require erikgall/flash-alert
- Add the following line to your service providers in your
config/app.php
file:
EGALL\FlashAlert\FlashAlertServiceProvider::class
- In the command line run the following command to publish the assets:
php artisan vendor:publish
- Import the component like such (assuming your are inside your main app.js located at
resources/assets/js
):
import FlashAlert from './components/flash-alert.vue';
- Add the component to your VueJs components
new Vue({
el: '#app',
components: {
FlashAlert
}
});
- Add the following line to your main blade layout file. This line must be wrapped in a div#app
<div id="app">
@include('vendor.flash.alert')
</div>
- Add the sass file to your main
app.sass
file:
@import "vendor/alert";
// For animations the package includes a sass copy of animate.css
@import "vendor/animate";
- Run gulp
The easiest way to use the package is in your controller like so:
class AuthController extends Controller {
public function login() {
// Login Success
alert()->success('You have been successfully signed in.')->autohide(4000);
return redirect()->to('/users');
}
}