@for(): directive is part of the conditional
loop operator directives. It is being used to loop through a list of item.
<?php
namespace spoova\mi\windows\Routes;
use Route;
class Home extends Route {
function __construct() {
self::call($this, [
// declare accepted urls
lastUrl() => 'home';
// parse variable arguments
SELF::ARGS => [
'list' => [1, 2, 3]
]
]);
}
function home($args) {
self::load('home' => compile($args));
}
}
@for(): condition. This is shown below
@for($i=0; $i <= count($list); $i++):
List {{ $list[$i] }} <br>
@endfor;
List 1
List 2
List 3