Answers for "how to write for loop in laravel blade"


laravel blade for loop

// For
@for ($i = 0; $i < max_value; $i++)
     //your code
@foreach ($items as $item)
     //your code
Posted by: Guest on July-04-2021

how to write for loop in laravel blade

    @for ($i = 0; $i < $max; $i++) //Where $max is whatever you need as break condition.
        <p>{{ $i }}</p> //This would print $i in a paragraph. You do whatever you need here.
Posted by: Guest on June-22-2020

laravel for loop

@for ($i = 0; $i < 10; $i++)
    The current value is {{ $i }}

@foreach ($users as $user)
    <p>This is user {{ $user->id }}</p>

@forelse ($users as $user)
    <li>{{ $user->name }}</li>
    <p>No users</p>

@while (true)
    <p>I'm looping forever.</p>
Posted by: Guest on October-12-2020

Browse Popular Code Answers by Language