/**
* Create a new component instance.
*
* @return void
*/
public function __construct($contactdata)
{
$this->contactdata = $contactdata;
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\Contracts\View\View|\Closure|string
*/
public function render()
{
return view('components.footer');
}
$this refers to the component itself and $this->contactdata to the contactdata property inside the component. If you don't declare the variable as a property of the component, you won't be able to access to it.
You just have to declare the public variable inside the component class.
public $contactdata;
public function __construct($contactdata)
{
$this->contactdata = $contactdata;
}
public function render()
{
return view('components.footer');
}