本文整理汇总了PHP中Anomaly\Streams\Platform\Ui\Table\TableBuilder::setTableResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP TableBuilder::setTableResponse方法的具体用法?PHP TableBuilder::setTableResponse怎么用?PHP TableBuilder::setTableResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Anomaly\Streams\Platform\Ui\Table\TableBuilder
的用法示例。
在下文中一共展示了TableBuilder::setTableResponse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle the command.
*
* @param Request $request
* @param ResponseFactory $response
* @throws \Exception
*/
public function handle(Request $request, ResponseFactory $response)
{
if ($this->builder instanceof MultipleTableBuilder) {
return;
}
$this->dispatch(new ExecuteAction($this->builder));
if (!$this->builder->getTableResponse()) {
$this->builder->setTableResponse($response->redirectTo($request->fullUrl()));
}
}
示例2: handle
/**
* Save the order of the entries.
*
* @param SectionCollection $sections
* @param TableBuilder $builder
* @param array $selected
*/
public function handle(SectionCollection $sections, Redirector $redirector, TableBuilder $builder, array $selected)
{
$prefix = $builder->getTableOption('prefix');
$edit = array_shift($selected);
$ids = implode(',', $selected);
if ($section = $sections->active()) {
$builder->setTableResponse($redirector->to($section->getHref('edit/' . $edit . '?' . $prefix . 'edit_next=' . $ids)));
}
}
示例3: handle
/**
* ExportAll the selected entries.
*
* @param TableBuilder $builder
* @param ResponseFactory $response
* @param array $selected
*/
public function handle(TableBuilder $builder, ResponseFactory $response, array $selected)
{
$model = $builder->getTableModel();
$stream = $builder->getTableStream();
$headers = ['Content-Disposition' => 'attachment; filename=' . $stream->getSlug() . '.csv', 'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0', 'Content-type' => 'text/csv', 'Pragma' => 'public', 'Expires' => '0'];
$callback = function () use($selected, $model) {
$output = fopen('php://output', 'w');
/* @var EloquentModel $entry */
foreach ($model->all() as $k => $entry) {
if ($k == 0) {
fputcsv($output, array_keys($entry->toArray()));
}
fputcsv($output, $entry->toArray());
}
fclose($output);
};
$builder->setTableResponse($response->stream($callback, 200, $headers));
}