本文整理汇总了PHP中Anomaly\Streams\Platform\Ui\Table\TableBuilder::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP TableBuilder::getTable方法的具体用法?PHP TableBuilder::getTable怎么用?PHP TableBuilder::getTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Anomaly\Streams\Platform\Ui\Table\TableBuilder
的用法示例。
在下文中一共展示了TableBuilder::getTable方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle the command.
*
* @param ResponseFactory $response
*/
public function handle(ResponseFactory $response)
{
$table = $this->builder->getTable();
$options = $table->getOptions();
$data = $table->getData();
$table->setResponse($response->view($options->get('wrapper_view', $this->builder->isAjax() ? 'streams::ajax' : 'streams::blank'), $data));
}
示例2: handle
/**
* Handle the command.
*
* @param Request $request
* @param Container $container
*/
public function handle(Request $request, ViewHandler $handler)
{
$table = $this->builder->getTable();
$options = $table->getOptions();
$views = $table->getViews();
if ($views->active()) {
return;
}
if ($view = $views->findBySlug($request->get($options->get('prefix') . 'view'))) {
$view->setActive(true);
}
if (!$view && ($view = $views->first())) {
$view->setActive(true);
}
// Nothing to do.
if (!$view) {
return;
}
// Set columns from active view.
if (($columns = $view->getColumns()) !== null) {
$this->builder->setColumns($columns);
}
// Set buttons from active view.
if (($buttons = $view->getButtons()) !== null) {
$this->builder->setButtons($buttons);
}
// Set actions from active view.
if (($actions = $view->getActions()) !== null) {
$this->builder->setActions($actions);
}
$handler->handle($this->builder, $view);
}
示例3: handle
/**
* Handle the command.
*/
public function handle()
{
$table = $this->builder->getTable();
$model = $this->builder->getModel();
/*
* If the model is already instantiated
* then use it as is.
*/
if (is_object($model)) {
$table->setModel($model);
return;
}
/*
* If no model is set, try guessing the
* model based on best practices.
*/
if ($model === null) {
$parts = explode('\\', str_replace('TableBuilder', 'Model', get_class($this->builder)));
unset($parts[count($parts) - 2]);
$model = implode('\\', $parts);
$this->builder->setModel($model);
}
/*
* If the model does not exist or
* is disabled then skip it.
*/
if (!$model || !class_exists($model)) {
return;
}
/*
* Set the model on the table!
*/
$table->setModel(app($model));
}
示例4: handle
/**
* Handle the command.
*/
public function handle()
{
$table = $this->builder->getTable();
$options = $table->getOptions();
$data = $table->getData();
$content = view($options->get('table_view', $this->builder->isAjax() ? 'streams::table/ajax' : 'streams::table/table'), $data)->render();
$table->setContent($content);
$table->addData('content', $content);
}
示例5: handle
/**
* Handle the command.
*/
public function handle()
{
$table = $this->builder->getTable();
$model = $this->builder->getModel();
if (is_string($model) && !class_exists($model)) {
return;
}
if (is_string($model)) {
$model = app($model);
}
if ($model instanceof EntryInterface) {
$table->setStream($model->getStream());
}
}
示例6: handle
/**
* Handle the command.
*
* @param Container $container
* @param ViewTemplate $template
* @param BreadcrumbCollection $breadcrumbs
*/
public function handle(Container $container, ViewTemplate $template, BreadcrumbCollection $breadcrumbs)
{
$table = $this->builder->getTable();
$table->addData('table', $table);
if ($handler = $table->getOption('data')) {
$container->call($handler, compact('table'));
}
if ($layout = $table->getOption('layout_view')) {
$template->put('layout', $layout);
}
if ($title = $table->getOption('title')) {
$template->put('title', $title);
}
$this->dispatch(new LoadTablePagination($table));
if ($breadcrumb = $table->getOption('breadcrumb')) {
$breadcrumbs->put($breadcrumb, '#');
}
}
示例7: build
/**
* Build the actions.
*
* @param TableBuilder $builder
*/
public function build(TableBuilder $builder)
{
$table = $builder->getTable();
$this->input->read($builder);
foreach ($builder->getActions() as $action) {
if (array_get($action, 'enabled', true)) {
$table->addAction($this->factory->make($action));
}
}
}
示例8: build
/**
* Build the filters.
*
* @param TableBuilder $builder
*/
public function build(TableBuilder $builder)
{
$table = $builder->getTable();
$this->input->read($builder);
foreach ($builder->getFilters() as $filter) {
if (array_get($filter, 'enabled') === false) {
continue;
}
$table->addFilter($this->factory->make($filter));
}
}
示例9: build
/**
* Build the headers.
*
* @param TableBuilder $builder
*/
public function build(TableBuilder $builder)
{
$table = $builder->getTable();
$this->input->read($builder);
if ($builder->getTableOption('enable_headers') === false) {
return;
}
foreach ($builder->getColumns() as $column) {
$column['builder'] = $builder;
$table->addHeader($this->factory->make($column));
}
}
示例10: handle
/**
* Handle the command.
*
* @param ModuleCollection $modules
*/
public function handle(ModuleCollection $modules)
{
$table = $this->builder->getTable();
/**
* Set the default sortable option.
*/
if ($table->getOption('sortable') === null) {
$stream = $table->getStream();
if ($stream && $stream->isSortable()) {
$table->setOption('sortable', true);
}
}
/**
* Sortable tables have no pages.
*/
if ($table->getOption('sortable') === true) {
$table->setOption('limit', $table->getOption('limit', 99999));
}
/**
* Set the default breadcrumb.
*/
if ($table->getOption('breadcrumb') === null && ($title = $table->getOption('title'))) {
$table->setOption('breadcrumb', $title);
}
/**
* If the table ordering is currently being overridden
* then set the values from the request on the builder
* last so it actually has an effect.
*/
if ($orderBy = $this->builder->getRequestValue('order_by')) {
$table->setOption('order_by', [$orderBy => $this->builder->getRequestValue('sort', 'asc')]);
}
/**
* If the permission is not set then
* try and automate it.
*/
if ($table->getOption('permission') === null && ($module = $modules->active()) && ($stream = $this->builder->getTableStream())) {
$table->setOption('permission', $module->getNamespace($stream->getSlug() . '.read'));
}
}
示例11: build
/**
* Build the views.
*
* @param TableBuilder $builder
*/
public function build(TableBuilder $builder)
{
$table = $builder->getTable();
$this->input->read($builder);
if ($builder->getTableOption('enable_views') === false) {
return;
}
foreach ($builder->getViews() as $view) {
if (array_get($view, 'enabled', true)) {
$table->addView($this->factory->make($view));
}
}
}
示例12: build
/**
* Build the columns.
*
* @param TableBuilder $builder
* @param $entry
* @return ColumnCollection
*/
public function build(TableBuilder $builder, $entry)
{
$table = $builder->getTable();
$columns = new ColumnCollection();
$this->input->read($builder);
foreach ($builder->getColumns() as $column) {
array_set($column, 'entry', $entry);
$column = $this->evaluator->evaluate($column, compact('entry', 'table'));
$column['value'] = $this->value->make($table, $column, $entry);
$columns->push($this->factory->make($column));
}
return $columns;
}
示例13: build
/**
* Build the buttons.
*
* @param TableBuilder $builder
* @param $entry
* @return ButtonCollection
*/
public function build(TableBuilder $builder, $entry)
{
$table = $builder->getTable();
$buttons = new ButtonCollection();
$this->input->read($builder);
foreach ($builder->getButtons() as $button) {
array_set($button, 'entry', $entry);
$button = $this->evaluator->evaluate($button, compact('entry', 'table'));
$button = $this->parser->parse($button, $entry);
$button = $this->value->replace($button, $entry);
$button = $this->factory->make($button);
if (!$button->isEnabled()) {
continue;
}
$buttons->push($button);
}
return $buttons;
}