Package Data | |
---|---|
Maintainer Username: | hocza |
Maintainer Contact: | jozsef@hocza.com (Jozsef Hocza) |
Package Create Date: | 2016-09-09 |
Package Last Update: | 2018-11-29 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-23 03:10:40 |
Package Statistics | |
---|---|
Total Downloads: | 469 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 17 |
Total Watchers: | 3 |
Total Forks: | 3 |
Total Open Issues: | 4 |
A package that simplifies the management of site-wide announcements. With "Laravel Announcement" you can display auto-expiring announcements.
1- composer require laravelhungary/announcement
predis/predis
for all of its operation.2- Add the followings to config/app.php
'providers' => [
...
LaravelHungary\Announcement\PackageServiceProvider::class,
],
'aliases' => [
...
'Announce' => LaravelHungary\Announcement\Facades\Announce::class,
]
3- run php artisan vendor:publish
and you will get
/config/announcement.php
/views/vendor/announcement/alert.blade.php
/Events/NewAnnouncement.php
/components/Announcement-bootstrap.vue
/components/Announcement-sweetalert.vue
4- That's it.
if you need to broadcast the announcements through something like web-sockets please check Event Broadcasting
Announce::create($title, $message, $type, $ttl);
Params
title
a short message.For example: Breaking news!
message
A bit longer message.For example: Our servers are under a DDoS attack. We are trying hard to mitigate it.
type
Type of the announcement.For example: success,info,danger,warning (or anything you would like to use) , Default is: info
ttl
When should the announcement expire. [Time to live] in seconds.Default is: 60 seconds
put {!! Announce::display() !!}
anywhere you want your announcement to be visible.
===
Announce::broadcast($title, $message, $type, $ttl, $transition, $channel_name);
Params
title
,message
,type
,ttl
same as the normal announcement
transition
what is animation type you want.
For example: fade , bounce, etc... Check Vue Transition , Default is: fade
channel_name
change it to override the config value "dont forget to also change it in the component file"Default is: public-announcement-channel
pusher
or socket.io
, it will just work 🍺.1- put Vue.component('my-announcement', require('./components/Announcement-bootstrap.vue'));
into your app.js file
2- put <my-announcement></my-announcement>
anywhere you want this announcement to show up. For example: your layout.blade.php file
if you want to use something like
Animate.css
follow Custom Transition Classes