i trying pass in array new class have access variable.
to this:
class appointmentdata { private $date = []; public function __construct(array $date) { $this->date = $date; } public function foo() { dd($this->$date); } }
then:
$appointmentdata = new appointmentdata($date);
however when calling function controller error:
cannot access empty property
am doing correctly in assigning variable in constructor etc?
your issue:
public function foo() { dd($this->$date); }
needs be
public function foo() { dd($this->date); }
Comments
Post a Comment