I have a $room variable inside a bootstrap modal and it is causing the problem here is the function in the reservationController
{
$room=Room::all();
return view('/allReservationChild', compact('room'));
}
the blade name is allReservationChild.blade.php and this is the part of the modal :
```<div class="modal fade" id="addres" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Delete Room</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form style="margin: 50px; text-transform: capitalize " action="/addReservation" method="POST" class="needs-validation" novalidate >
@csrf
<div class="modal-body">
<div class="form-group">
<label for="exampleFormControlSelect1">Select the Room you want to reserve</label>
<select class="form-control" id="exampleFormControlSelect1" name="room_id" required>
<option value=""></option>
@foreach($room as $items)
<option value=""></option>
@endforeach
</select>
</div>
<div class="mb-3">
<label for="exampleFormControlTextarea1" class="form-label">Objectif :</label>
<select class="form-control" id="exampleFormControlTextarea1" name="objectif" required>
<option value=""></option>
<option value="Booking room for a replacement session ">Booking room for a replacement session </option>
<option value="Booking room for a random session">Booking room for a random session</option>
<option value="Booking room for an event">Booking room for an event</option>
<option value="Booking room for an exam">Booking room for an exam</option>
<option value="Booking room for discussion of the graduation thesis">Booking room for discussion of the graduation thesis</option>
<option value="other">other</option>
</select>
</div>
<div class="form-group">
<label class="control-label">Reservation date</label></br>
<input class="form-control" type="date" id="Date_beginning" name="date" required>
</div>
<div class="form-group">
<label for="time">Select time period</label>
<select class="form-control" id="time" name="time" required>
<option value=""></option>
<option value="8:30-10:30">8.30-10.30</option>
<option value="10:30-12:30">10.30-12.30</option>
<option value="13:30-15:30">13.30-15.30</option>
</select>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-outline-danger" name="supp" >Add Reservation</button>
</div>
</form>
</div>
</div>
</div>
and for the **web**
```Route::get('/addReservation',[\App\Http\Controllers\reservationController::class,'create']);
I don't know why ha can not know define the $room variable I think it is because of the modal or something. and the modal I'm sure it is right because I used the same modal in another blade and it works perfectly so the problem I think is in the controller or the web I am not sure
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/IoQxzbr
via IFTTT
Aucun commentaire:
Enregistrer un commentaire