本文整理汇总了PHP中Block::actionFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP Block::actionFrom方法的具体用法?PHP Block::actionFrom怎么用?PHP Block::actionFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block
的用法示例。
在下文中一共展示了Block::actionFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fill
function fill()
{
if (!$this->filled) {
$this->filled = true;
if ($custom = $this->fullCustomID()) {
$handler = Block::factory($custom);
$func = 'menu_' . strtolower($action = Block::actionFrom($custom));
if (method_exists($handler, $func)) {
$handler->{$func}($this);
} else {
$this->html = $handler->execute($action, $this->argArray())->render();
}
}
}
return $this;
}
示例2: serve
function serve($args = array())
{
if ($server = $this->findServer()) {
// replace (:N) patterns inside controller string, e.g.: 'user@(;1)'.
static::references($server, $args);
// prepend arguments that can be defined in the server string after
// a space: 'help@show contacts'.
$server = strtok($server, ' ');
$prepend = '' . strtok(null);
$prepend === '' or $args = array_merge(explode(' ', $prepend), $args);
// construct server instance (either a Block or a regular Controller).
$this->lastArgs = $args;
$block = $this->lastServer = Block::factory($server);
// if server is not a traditional controller but a Vane block - set it up.
if ($block instanceof Block) {
$block->top = $this->lastLayout;
$block->isServer = true;
}
// produce response (can be of arbitrary type).
$this->lastArgs = $args;
$response = $block->execute(Block::actionFrom($server), $args);
// convert response to a Laravel\Response descendant.
return with(new Block())->toResponse($response);
}
}