for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Boduch\Grid\Components;
class Button extends Component
{
/**
* @var string
*/
protected $url;
protected $text;
* @var array
protected $attributes = [];
* @param string $url
* @param string $text
* @param array $attributes
public function __construct($url, $text, array $attributes = [])
$this->url = $url;
$this->text = $text;
$this->setDefaultAttributes($attributes);
}
* @return \Illuminate\Support\HtmlString
public function render()
return $this->tag('a', $this->wrapSpan($this->text), $this->attributes);
protected function wrapSpan($text)
return $this->tag('span', $text);
protected function setDefaultAttributes(array $attributes = [])
$this->attributes = array_merge(['class' => 'btn btn-default', 'href' => $this->url], $attributes);