Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Latest commit

 

History

History
40 lines (32 loc) · 1.02 KB

blade-directives.md

File metadata and controls

40 lines (32 loc) · 1.02 KB

ActiveState Blade directives

The following if Blade directives are defined by default for their equivalent checks:

  • @path_is(): checkPathIs()
  • @path_has(): checkPathHas()
  • @route_is(): checkRouteIs()
  • @route_in(): checkRouteIn()
  • @route_has(): checkRouteHas()
  • @query_is(): checkQueryIs()
  • @query_has(): checkQueryHas()
  • @query_has_only(): checkHasOnly()
  • @query_contains(): checkQueryContains()

All these directives have their opposites. Just prepend "not_" to the directive.

Examples of use:

If/else check:

@route_is('user.show')
    // The route is user.show
@elseroute_is
    // The route is not user.show
@endroute_is

Negative check:

@not_route_is('user.show')
    // The route is NOT user.show
@endnot_route_is

The directives simply replace Active::check* calls, which can obviously be used instead, if you prefer.

Note: If you change the Blade directives configuration, you need to clear the compiled views:

php artisan view:clear