SHARE
TWEET

Untitled

a guest Jun 24th, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function store(Request $request)
  2.      {
  3.          $data =[
  4.            $request->customer_id,
  5.            $request->room_no,
  6.            $request->start_date,
  7.            $request->end_date,
  8.            $request->category,
  9.          ];
  10.        dd($data);
  11.      }
  12.      
  13. public function up()
  14.         {
  15.         Schema::create('reservations', function (Blueprint $table) {
  16.             $table->bigIncrements('id');
  17.             $table->integer('room_no')->unsigned();
  18.             $table->foreign('room_no')->references('room_no')->on('rooms');
  19.             $table->date('start_date');
  20.             $table->date('end_date');
  21.             $table->decimal('amount')->default(0.0);
  22.             $table->bigInteger('customer_id')->unsigned();
  23.             $table->foreign('customer_id')->references('id')->on('customers');
  24.             $table->string('category');
  25.             $table->timestamps();
  26.         });
  27.      
  28. <form method="POST" action="/reservations/">
  29.         @csrf
  30.  
  31.         <div>
  32.           <p>
  33.                <b>Enter Reservation for {{$customer->first_name}} {{$customer->last_name}}</b>
  34.            </p>
  35.            <h4 class="info-text">Select Room<br>
  36.             <select name="room_no" id="room_no">
  37.                 <option value=100>100</option>
  38.              //...there are more but no need to post ALL of them here
  39.               </select>
  40.            </h4>
  41.             <h4 class="info-text">Select Room Type<br>
  42.              <select name="category" id="category">
  43.                <option value="Deluxe">Deluxe</option>
  44.                // shortened for question's sake again
  45.             </h4>
  46.             <p>
  47.         <b>Enter Start and End Date:</b>
  48.            </p>
  49.            <table>
  50.                <tr>
  51.                    <td>
  52.                      <input class="input" type="date" name="start_date" size="11" />
  53.                      <input class="input" type="date" name="end_date" size="11" />
  54.                    </td>
  55.                </tr>
  56.            </table>
  57.            <b>Cost of Stay</b>
  58.            <td>
  59.              <input class="input" type="decimal" name="amount" size="11"/>
  60.            </td>
  61.         <p><button type="submit">Create Reservation</button></p>
  62.     </div>
  63.   </form>
  64.      
  65. Route::resource('reservations', 'ReservationsController');
  66.     Route::get('/reservations/create/{customer_id}',
  67.      "ReservationsController@create_reservation");
  68.      
  69. array:5 [▼
  70.   0 => null
  71.   1 => "106"
  72.   2 => "2019-04-16"
  73.   3 => "2019-04-30"
  74.   4 => "Economy"
  75. ]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top