invoked() function is a window function that matches the current page url
with the supplied url and returns a true value if both url matches. By default, this function
is case sensitive and the only way to declare it as case-insensitive is to prefix the url supplied
with an exclamation mark !. This is explained with example below
if( invoked('some/URL') ) {
//do something
}
http://domain/some/URL. The case-sensive
check will automatically be applied. However, to ignore case-sensitivity, we need to prefix the url with exclamation
mark as shown below:
if( invoked('!some/URL') ) {
//do something
}
! is applied, the invoke will not check for case sensitivity on the url suppled. This means that
a url http://domain/some/URL and http://domain/some/url will return true on invoke() function.
The invoke is usually used in window shutter middlewares. You can see a sample of this
below:
<?php
namespace spoova/mi/windows/Routes;
use Window;
class Home extends Window {
function __construct() {
SELF::CALL($this, [
'home/user/profiles' => 'profiles',
'home/user/settings' => 'settings',
SELF::ONCALL => function() {
if( invoked('home/user/profiles') ) {
//do this for specified url
}
if( invoked('home/user/settings') ) {
//do this for specified url
}
}
]);
}
}