Skip to content
dubpub edited this page Feb 17, 2015 · 3 revisions

####Statements Statements are supposed to be used to trigger command provider's methods or properties. All returned values will be rendered.

Syntax Description
@command.property @> outputs property value
@command.property->method() @> chaining is available for properties
@command.method() @> outputs result of method execution
@command.method(1, '1', [], true, false, new stdClass(), $paramN) @> passing parameterets into method syntax
@command.method()->otherMethod($param1, $paramN) chaining returns are avaliable for methods

####Cached statements Cached statements are supposed to be used to trigger command provider's method or property. All returned values will be rendered only once. Once blade view will be rendered and cached statement won't be envoked until this view won't be changed.

Syntax Description
@::command.property @> outputs property value
@::command.property->method() @> chaining is available for properties
@::command.method() @> outputs result of method execution
@::command.method($param1, $paramN) @> passing parameterets into method syntax
@::command.method()->otherMethod($param1, $paramN) chaining returns are avaliable for methods

####Conditions

Conditions are base upon command provider's method execution results or properties.

Syntax Description
@?command.property ?@> alternative to
@if($command->property)
@!?command.property ?@> alternative to
@unless($command->property)
@?command.method() ?@> alternative to
@if($command->method())
@?command.method($param1, $paramN) ?@> alternative to
@if($command->method($param1, $paramN))
@?command.method()->otherMethod($paramN) ?@> alternative to
@if($command->method()->otherMethod($paramN))
@?-> alternative to
@else
@?> alternative to
@endif

####Loops

Simple alternative for native @foreach and @for loops

@in($collection||$value)            @foreach($collection as $value)
    {{$value}}                          {{$value}}
@in>                                @endforeach
    
@in($collection||$key||$value)      @foreach($collection as $key => $value)
    {{$key}} equals {{$value}}          {[$key}} equals {{$value}}
@in>                                @endforeach
  
@up($collection||$value)            @for($key = 0; $key < count($collection); $key++)
    {{$value}}                          <?php $value = $collection[$key]; ?>
@up>                                    {{$value}}
                                    @endfor
                                        
@up($collection||$key||$value)      @for($key = 0; $key < count($collection); $key++)
    {{$key}} equals {{$value}}          <?php $value = $collection[$key]; ?>
@up>                                    {{$key}} equals {{$value}} 
                                    @endfor
    
@down($collection||$value)          @for($key = count($collection) - 1; $key == 0; $key--)
    {{$value}}                          <?php $value = $collection[$key]; ?>
@down>                                  {{$value}} 
                                    @endfor
    
@down($collection||$key||$value)    @for($key = count($collection) - 1; $key == 0; $key--)
    {{$key}} equals {{$value}}        <?php $value = $collection[$key]; ?>
@down>                                {{$key}} equals {{$value}} 
                                    @endfor

####Wrappers

Bladed extension provides a wrapper system. All method's that will dial wrappers will always receive LaravelCommode\Bladed\Compilers\TemplateCompiler as first argument and then all the others.

@|command.wrapperMethod {
    This template can be rendered later. {{$renderTime}}
}|()@>
    
@|command.wrapperMethod {
    This template can be rendered later. {{$renderTime}}
}|($param1, $paramN)@>

####Cached wrappers

Wrappers that will be rendered only at once.

@::|command.method {
    This template can be rendered later. {{$renderTime}}
}|()@>

@::|command.method {
    This template can be rendered later. {{$renderTime}}
}|($param1, $paramN)@>
Clone this wiki locally