poldixd / laravel-blade-repeat
Installs: 1 641
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- illuminate/support: ^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^7.0|^8.0|^9.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- spatie/pest-plugin-snapshots: ^2.1
Conflicts
- spatie/phpunit-snapshot-assertions: <=4.2.11
README
Blade directive for repeating content for Laravel 9.x and Laravel 10.x and PHP >= 8.1
Installation
composer require poldixd/laravel-blade-repeat
Usage
@repeat(3) <div>Repeat me three times.</div> @endrepeat
Output:
<div>Repeat me three times.</div> <div>Repeat me three times.</div> <div>Repeat me three times.</div>
You can use the $iteration
variable inside the loop for displaying the actual iteration count:
@repeat(3) <div>Repeat me three times. I'am number #{{ $iteration }}</div> @endrepeat
Output:
<div>Repeat me three times. I'am number #1</div> <div>Repeat me three times. I'am number #2</div> <div>Repeat me three times. I'am number #3</div>
Changelog
Please see CHANGELOG.
Testing
composer test
License
The MIT License (MIT). Please see License File for more information.