Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function store(Request $request)
- {
- $data =[
- $request->customer_id,
- $request->room_no,
- $request->start_date,
- $request->end_date,
- $request->category,
- ];
- dd($data);
- }
- public function up()
- {
- Schema::create('reservations', function (Blueprint $table) {
- $table->bigIncrements('id');
- $table->integer('room_no')->unsigned();
- $table->foreign('room_no')->references('room_no')->on('rooms');
- $table->date('start_date');
- $table->date('end_date');
- $table->decimal('amount')->default(0.0);
- $table->bigInteger('customer_id')->unsigned();
- $table->foreign('customer_id')->references('id')->on('customers');
- $table->string('category');
- $table->timestamps();
- });
- <form method="POST" action="/reservations/">
- @csrf
- <div>
- <p>
- <b>Enter Reservation for {{$customer->first_name}} {{$customer->last_name}}</b>
- </p>
- <h4 class="info-text">Select Room<br>
- <select name="room_no" id="room_no">
- <option value=100>100</option>
- //...there are more but no need to post ALL of them here
- </select>
- </h4>
- <h4 class="info-text">Select Room Type<br>
- <select name="category" id="category">
- <option value="Deluxe">Deluxe</option>
- // shortened for question's sake again
- </h4>
- <p>
- <b>Enter Start and End Date:</b>
- </p>
- <table>
- <tr>
- <td>
- <input class="input" type="date" name="start_date" size="11" />
- <input class="input" type="date" name="end_date" size="11" />
- </td>
- </tr>
- </table>
- <b>Cost of Stay</b>
- <td>
- <input class="input" type="decimal" name="amount" size="11"/>
- </td>
- <p><button type="submit">Create Reservation</button></p>
- </div>
- </form>
- Route::resource('reservations', 'ReservationsController');
- Route::get('/reservations/create/{customer_id}',
- "ReservationsController@create_reservation");
- array:5 [▼
- 0 => null
- 1 => "106"
- 2 => "2019-04-16"
- 3 => "2019-04-30"
- 4 => "Economy"
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement