44
55## Introduction
66
7- A Laravel package to track, limit & restrict usages by setting them on your models (usually User model) .
7+ A Laravel package to track, limit, & restrict usages of users, accounts, or any other model.
88
99## Features
1010
@@ -25,6 +25,7 @@ Basically with this package you can track your users' or any other models' usage
2525
2626- API usages per second, minute, month, etc
2727- Resource creation. E.g: projects, teams, users, products, etc
28+ - Resource usages. E.g: storage, etc
2829
2930## Versions
3031
@@ -57,7 +58,7 @@ First, you need to use the **HasLimits** trait on your model.
5758``` php
5859use NabilHassen\LaravelUsageLimiter\Traits\HasLimits;
5960
60- class User extends Authenticable
61+ class User extends Authenticatable
6162{
6263 use HasLimits;
6364}
@@ -146,6 +147,8 @@ $user->unuseLimit('projects', 'standard', 3); OR
146147$user->unuseLimit($projectsStandardLimit, amount: 3);
147148```
148149
150+ > ###### _ Both useLimit and unuseLimit methods throws an exception if a user exceeded limits or tried to unuse limits below 0_ .
151+
149152#### Reset Limits for models
150153
151154``` php
@@ -157,11 +160,11 @@ $user->resetLimit($projectsStandardLimit);
157160
158161| Method | Return Type | Parameters |
159162| ---------------- | ----------- | ---------------------------------------------------------------------------------- |
160- | setLimit | bool | string\| Limit $limit, <br > ?string $plan = null, <br > float\| int $usedAmount = 0.0 |
163+ | setLimit | true \| throw | string\| Limit $limit, <br > ?string $plan = null, <br > float\| int $usedAmount = 0.0 |
161164| unsetLimit | bool | string\| Limit $limit, <br > ?string $plan = null |
162165| isLimitSet | bool | string\| Limit $limit, <br > ?string $plan = null |
163- | useLimit | bool | string\| Limit $limit, <br > ?string $plan = null, <br > float\| int $amount = 1.0 |
164- | unuseLimit | bool | string\| Limit $limit, <br > ?string $plan = null, <br > float\| int $amount = 1.0 |
166+ | useLimit | true \| throw | string\| Limit $limit, <br > ?string $plan = null, <br > float\| int $amount = 1.0 |
167+ | unuseLimit | true \| throw | string\| Limit $limit, <br > ?string $plan = null, <br > float\| int $amount = 1.0 |
165168| resetLimit | bool | string\| Limit $limit, <br > ?string $plan = null |
166169| hasEnoughLimit | bool | string\| Limit $limit, <br > ?string $plan = null |
167170| usedLimit | float | string\| Limit $limit, <br > ?string $plan = null |
0 commit comments