I’m trying to use @include. But i got this error : Undefined variable: bookOther (View: /home/infinitr/pinus.infinitree.eco/modules/Tour/Views/frontend/guest_list.blade.php)
How can i fix it?
The Controller :
public function guests_list($id){
$booking = Booking::where('id', $id)->first();
$bookOther = BookOther::where('booking_id', '=', $booking->id)->get();
return view('Tour::frontend.guest_list', ['booking'=>$booking, 'bookOther'=>$bookOther, 'layout'=>'guest_list']);
}
The Route :
Route::get('/guest_list/{id}', 'ModulesTourControllersTourController@guests_list')->name('guest_list');
The blade :
<div id="booking-customer-{{$booking->id}}" class="tab-pane fade"><br>
@include('Tour::frontend.guest_list')
</div>
2
Answers
You can try to change:
To this:
Try passing the variable in the
@include