I am new to Laravel and currently working on a project where the guests enter form data for booking a room in a hotel and after submitting it, they will be redirected to a page showing their booking they have just done. I know this can be done by allowing guests to create login account but my project requires login only for the backed(admin). (Q2.)Also the guests can view booking by entering the booking ID and their last name.
My controller:
{
$book = new book();
$book->title = $request->input('title');
$book->fname = $request->input('firstname');
$book->lname = $request->input('lastname');
$book->country = $request->input('country');
$book->phone = $request->input('phone');
$book->email = $request->input('email');
$book->no_rooms = $request->input('no_rooms');
$book->room_type_id = $request->input('type_room');
$book->no_adults = $request->input('adults');
$book->no_children = $request->input('children');
$book->meal_id = $request->input('meal');
$book->check_in = $request->input('check_in');
$book->check_out = $request->input('check_out');
$book->save();
}
public function show(book $book)
{
return view('book.show', compact('book'));
} ```
The way I want it to display after it has been submitted:
`<div class="row">
<div class="col-12 text-center">
<h3> Thank you for reserving with us! </h3>
</div>
</div>
<div class="row">
<div class="col-6">
<table class="table table-striped text-dark">
<tbody>
<tr>
<td> Name: </td>
<td> </td>
</tr>
<tr>
<td> Phone </td>
<td> </td>
</tr>
<tr>
<td> Email </td>
<td> </td>
</tr>
<tr>
<td> Phone </td>
<td> </td>
</tr>
<tr>
<td> Passport Issued: </td>
<td> </td>
</tr>
<tr>
<td> Number of rooms: </td>
<td> </td>
</tr>
<tr>
<td> Room Type </td>
<td> </td>
</tr>
<tr>
<td> No of adults: </td>
<td> </td>
</tr><tr>
<td> No of children: </td>
<td> </td>
</tr>
<tr>
<td> Meal plan: </td>
<td> </td>
</tr>
<tr>
<td> Check-in: </td>
<td> </td>
</tr>
<tr>
<td> Check-out: </td>
<td> </td>
</tr>
</tbody>
</table>
</div>
</div>
Aucun commentaire:
Enregistrer un commentaire