This package abstracts and simplifies managing monthly service limits for users in your Laravel application.
You can install the package via composer:
composer require devworkout/laravel-user-limits
Add \DevWorkout\UserLimits\Models\HasLimits trait to User model:
use HasLimits;
Add limits:refresh
to your Console Kernel Schedule.
\DevWorkout\UserLimits\Limit::create([
'subject' => 'domains',
'allowed' => 3,
'period' => 'permanent'
]);
\DevWorkout\UserLimits\Limit::create([
'subject' => 'cards',
'package' => 'pro',
'allowed' => 100,
'period' => 'monthly'
]);
echo auth()->user()->usage('cards')->allowed();
echo auth()->user()->usage('cards')->used();
echo auth()->user()->usage('cards')->remaining();
echo auth()->user()->usage('cards','pro')->exceeded();
echo auth()->user()->usage('cards')->reset();
echo auth()->user()->usage('cards')->increment();
echo auth()->user()->usage('domains')->decrement();
echo auth()->user()->usage('cards')->refreshed_at();
echo auth()->user()->usage('cards')->next_refresh_at();
composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email us instead of using the issue tracker.
Give us a star!
The MIT License (MIT). Please see License File for more information.