Skip to content

poldixd/laravel-blade-repeat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

poldixd/laravel-blade-repeat

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.