My $links
and $sliderimages
variables work great. The $klas
variable has been made by the same way like the first two I said, and for some reason it says that it is undefined variable.
First $klas
was meant for another view, however I decided to test it out on my home page view where the other 2 variables were working were, but when i have put the $klas
the same error occurs.
Route::get('/', function () {
$sliderimages = App\Sliderimage::all();
$links = App\Link::all();
$klas = App\Kla::all();
return view('home', compact('sliderimages'), compact('links'), compact('klas'));
});
That is on web.php file
@foreach($links as $link)
<div class="col-lg-4">
<img src="{{ Voyager::image( $link->image ) }}" class="rounded-circle" width="140" height="140" style="margin-left:25%">
<h2>"{{$link->title}}"</h2>
<p>"{{$link->text}}"</p>
<p><a class="btn btn-secondary" href="{{$link->slug}}" role="button">За повече информация. »</a></p>
</div>
@endforeach
</div>
@foreach($klas as $kla)
<p>"{{$kla->klastitle}}"</p>
@endforeach
That is on home.blade . php
The error is:
Undefined variable: klas (View: D:\xampp\htdocs\koko\diplomnata\resources\views\home.blade.php)