title($title);
}
if ($content) {
$this->content($content);
}
$this->class('box');
}
/**
* Set content padding.
*
* @param string $padding
*/
public function padding(string $padding)
{
$this->padding = 'padding:'.$padding;
return $this;
}
/**
* Set box content.
*
* @param string $content
*
* @return $this
*/
public function content($content)
{
if ($content instanceof LazyGrid) {
$content->simple();
}
$this->content = $this->formatRenderable($content);
return $this;
}
/**
* Set box title.
*
* @param string $title
*
* @return $this
*/
public function title($title)
{
$this->title = $title;
return $this;
}
/**
* Set box as collapsable.
*
* @return $this
*/
public function collapsable()
{
$this->tools[] =
'';
return $this;
}
/**
* Set box as removable.
*
* @return $this
*/
public function removable()
{
$this->tools[] =
'';
return $this;
}
/**
* Set box style.
*
* @param string $styles
*
* @return $this|Box
*/
public function style($styles)
{
$styles = array_map(function ($style) {
return 'box-'.$style;
}, (array) $styles);
$this->class = $this->class.' '.implode(' ', $styles);
return $this;
}
/**
* @param string|Renderable|\Closure $content
*
* @return $this
*/
public function tool($content)
{
$this->tools[] = $this->toString($content);
return $this;
}
/**
* Add `box-solid` class to box.
*
* @return $this
*/
public function solid()
{
return $this->style('solid');
}
/**
* Variables in view.
*
* @return array
*/
public function defaultVariables()
{
return [
'title' => $this->title,
'content' => $this->toString($this->content),
'tools' => $this->tools,
'attributes' => $this->formatHtmlAttributes(),
'padding' => $this->padding,
];
}
}