Skip to content

Commit 45b4830

Browse files
author
enricodelazzari
committed
UPDATE make Helper macroable
1 parent 9070c12 commit 45b4830

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/Helper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
use Illuminate\Database\Eloquent\Model;
66
use Illuminate\Support\Arr;
77
use Illuminate\Support\Str;
8+
use Illuminate\Support\Traits\Macroable;
89

910
class Helper
1011
{
12+
use Macroable;
13+
1114
public static function paginationLimit(int $default = 16, int $max = 48): int
1215
{
1316
$limit = request()->get('limit') ?? $default;

tests/HelpersTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,9 @@
101101
['model' => Article::class, 'result' => 'id'],
102102
['model' => new Article(), 'result' => 'id'],
103103
]);
104+
105+
it('is macroable', function () {
106+
hlp()->macro('foo', fn () => 'macroable');
107+
108+
expect(hlp()->foo())->toBe('macroable');
109+
});

0 commit comments

Comments
 (0)