本文整理汇总了PHP中Anomaly\Streams\Platform\Ui\Table\TableBuilder::getTableOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP TableBuilder::getTableOptions方法的具体用法?PHP TableBuilder::getTableOptions怎么用?PHP TableBuilder::getTableOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Anomaly\Streams\Platform\Ui\Table\TableBuilder
的用法示例。
在下文中一共展示了TableBuilder::getTableOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Execute an action.
*
* @param TableBuilder $builder
* @param ActionInterface $action
* @throws \Exception
*/
public function execute(TableBuilder $builder, ActionInterface $action)
{
$options = $builder->getTableOptions();
$handler = $action->getHandler();
// Self handling implies @handle
if (is_string($handler) && !str_contains($handler, '@')) {
$handler .= '@handle';
}
/*
* Authorize the action.
*/
if (!$this->authorizer->authorize($action->getPermission())) {
$this->messages->error('streams::message.403');
return;
}
/*
* Get the IDs of the selected rows.
*/
$selected = $this->request->get($options->get('prefix') . 'id', []);
/*
* If the handler is a callable string or Closure
* then call it using the IoC container.
*/
if (is_string($handler) || $handler instanceof \Closure) {
if (is_string($handler) && class_exists($handler)) {
$handler .= '@handle';
}
app()->call($handler, compact('builder', 'selected'));
return;
}
/*
* If the handle is an instance of ActionHandlerInterface
* simply call the handle method on it.
*/
if ($handler instanceof ActionHandlerInterface) {
$handler->handle($builder, $selected);
return;
}
throw new \Exception('Action $handler must be a callable string, Closure or ActionHandlerInterface.');
}