I call the component from my controller here:
Blade::renderComponent(new Card('Benutzer','Alle Benutzer',[$this->tableColumns()]));
You can see, the 3rd Argument is a array.
<?php
namespace Hippoz\Datatable\View\Components;
use Illuminate\View\Component;
class Card extends Component
{
public $header;
public $cardHeader;
public $tableColumns;
public function __construct(string $header, string $cardHeader,array $tableColumns)
{
$this->header = $header;
$this->cardHeader = $cardHeader;
$this->tableHeaders = $tableHeaders;
$this->tableColumns = $tableColumns;
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('hippoz::components.card');
}
}
I can not pass the array $tableColumns. I get allways,
Array to string conversion