Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nabilhassen committed Jun 14, 2024
1 parent 2f189e6 commit b8e1342
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ $projectsProLimit->decrementBy(3);
###### Possible values for "reset_frequency" column

- null
- "every second"
- "every second" // works in Laravel >= 10
- "every minute"
- "every hour"
- "every day"
Expand Down Expand Up @@ -155,18 +155,18 @@ $user->resetLimit($projectsStandardLimit);

#### All available methods

| Method | Return Type | Parameters |
| ---------------- | ----------- | ------------------------------------------------------------------------------------------ |
| setLimit | bool | string\|LimitContract $limit, <br> ?string $plan = null, <br> float\|int $usedAmount = 0.0 |
| unsetLimit | bool | string\|LimitContract $limit, <br> ?string $plan = null |
| isLimitSet | bool | string\|LimitContract $limit, <br> ?string $plan = null |
| useLimit | bool | string\|LimitContract $limit, <br> ?string $plan = null, <br> float\|int $amount = 1.0 |
| unuseLimit | bool | string\|LimitContract $limit, <br> ?string $plan = null, <br> float\|int $amount = 1.0 |
| resetLimit | bool | string\|LimitContract $limit, <br> ?string $plan = null |
| hasEnoughLimit | bool | string\|LimitContract $limit, <br> ?string $plan = null |
| usedLimit | float | string\|LimitContract $limit, <br> ?string $plan = null |
| remainingLimit | float | string\|LimitContract $limit, <br> ?string $plan = null |
| limitUsageReport | array | string\|LimitContract\|null $limit = null, <br> ?string $plan = null |
| Method | Return Type | Parameters |
| ---------------- | ----------- | ---------------------------------------------------------------------------------- |
| setLimit | bool | string\|Limit $limit, <br> ?string $plan = null, <br> float\|int $usedAmount = 0.0 |
| unsetLimit | bool | string\|Limit $limit, <br> ?string $plan = null |
| isLimitSet | bool | string\|Limit $limit, <br> ?string $plan = null |
| useLimit | bool | string\|Limit $limit, <br> ?string $plan = null, <br> float\|int $amount = 1.0 |
| unuseLimit | bool | string\|Limit $limit, <br> ?string $plan = null, <br> float\|int $amount = 1.0 |
| resetLimit | bool | string\|Limit $limit, <br> ?string $plan = null |
| hasEnoughLimit | bool | string\|Limit $limit, <br> ?string $plan = null |
| usedLimit | float | string\|Limit $limit, <br> ?string $plan = null |
| remainingLimit | float | string\|Limit $limit, <br> ?string $plan = null |
| limitUsageReport | array | string\|Limit\|null $limit = null, <br> ?string $plan = null |

#### All available commands

Expand Down Expand Up @@ -207,10 +207,10 @@ Add `limit:reset` command to the console kernel.
protected function schedule(Schedule $schedule)
{
...
// Laravel 8 & 9
// Laravel < 10
$schedule->command('limit:reset')->everyMinute();

// Laravel 10 & 11
// Laravel >= 10
$schedule->command('limit:reset')->everySecond();
...
}
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasLimits.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function remainingLimit(string|LimitContract $name, ?string $plan = null)
return $limit->allowed_amount - $limit->pivot->used_amount;
}

public function getModelLimit(string|LimitContract $name, ?string $plan = null)
public function getModelLimit(string|LimitContract $name, ?string $plan = null): LimitContract
{
$limit = app(LimitContract::class)::findByName($name, $plan);

Expand Down

0 comments on commit b8e1342

Please sign in to comment.