Here is my controller code:
$exam_categories = ExamCategory::all();
return view('test.test-home')->withExamCategories($exam_categories);
Here is my blade template code:
<select class="custom-select form-control-lg exam-category" id="exam-category" style="font-weight: bold">
<option selected>Select</option>
@foreach($exam_categories as $examCategory)
<option value="{{$examCategory->id}}">{{$examCategory->Category}}</option>
@endforeach
</select>
If I run this code then it shows the following error:
Undefined variable: exam_categories (View: /var/www/myproj/resources/views/test/test-home.blade.php)
It was working fine in laravel 5.4 version, but when I updated to laravel 5.8, it is not working.