Download the PHP package jamesmills/watchable without Composer
On this page you can find all versions of the php package jamesmills/watchable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jamesmills/watchable
More information about jamesmills/watchable
Files in jamesmills/watchable
Package watchable
Short Description A package to allow your Models to become watchable by a User
License MIT
Homepage https://github.com/jamesmills/watchable
Informations about the package watchable
Laravel Watchable
Enable users to watch various models in your application.
- Designed to work with Laravel Eloquent models
- Just add the trait to the model you would like to be watchable
- Watches are unique for one model and one user
- Events are fired on
watched
andunwatched
methods - Built to work with Laravel Notifications
Installation
Pull in the package using Composer
composer require jamesmills/watchable
Note: If you are using Laravel 5.5, the next step for provider are unnecessary. Laravel Watchable supports Laravel Package Discovery.
Include the service provider within app/config/app.php
.
Publish and run the database migrations
Sample Usage and Boilerplate
I wrote a blog post to give you some boilerplate code that you can use in your application to wrap around the Laravel Watchable package.
https://jamesmills.co.uk/2017/10/22/laravel-watchable-package
How to use
Prepare your model to be watched
Simply add the watchable
trait to your model
Available methods
Watch a model
Unwatch a model
Toggle the watching of a model
You can optionally send the if you don't want to use the built in functionality.
Find out if the current user is watching the model
Get a collection of the user who are watching a model
Use with Notifications
One of the main reasons I built this package was to scratch my own itch with an application I am building. I wanted to be able to send notifications to user who were watching a given model and I also wanted to allow users to be able to watch a number of different models.
License
This package is 100% free and open-source, under the MIT license. Use it however you want.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
All versions of watchable with dependencies
illuminate/support Version ~5.3.0 || ~5.4.0 || ~5.5.0 || 5.6.* || 5.7.* || 5.8.* || ^6 || ^7 || ^8