so I'm having an issue with a laravel project and it makes no sense to me why this is happening, so maybe someone out there has experienced this.
In my home page, I load a partial, we'll call it: _homeContent.blade.php
. In the controller for the home page, I am pinging an API, gathering data and returning it to the home page, as a $quotes
variable.
So:
return view('home', compact('quotes'));
In my view, I have the loop:
@foreach($quotes as $quote)
I do my loop things here.
@endforeach
So that works fine, no issues, the data is coming in as I expect it to. Further down the page, I have a link to another page. Just a standard a href="/my-about-page" for example. When I click it, I get an error that says:
Undefined variable: quotes(View: /my/path/here/_homeContent.blade.php)
Question is: Why am I getting this error on my about page, telling me that there is an undefined variable on _homeContent.blade.php
. I was just on the home page and it worked, I leave the page, and it breaks the next page.