I need help with passing the variable I have initialized using __construct() to view in Laravel.
Here is my controller code
protected $profileInfo;
public function __construct(){
$this->profileInfo = Profile::with('address')->where('id', '=', '1')->get();
}
public function index(){
$this->profileInfo;
return view('admin_pages.profile', compact('profileInfo'));
}
I get an error undefined variable profileInfo