mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
added rate to booking table
This commit is contained in:
@@ -17,7 +17,10 @@ class BookingController extends Controller
|
||||
{
|
||||
|
||||
public function index(){
|
||||
$booking = Booking::where('user_id',Auth::user()->id)->get();
|
||||
$booking = Booking::select('bookings.id', 'rates.bookings.term')
|
||||
->leftJoin('rates', 'bookings.rate_id', '=', 'rates.id')
|
||||
->where('user_id',Auth::user()->id)
|
||||
->get();
|
||||
return $booking;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddRateToBooking extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('bookings', function (Blueprint $table) {
|
||||
$table->double('rate')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('bookings', function (Blueprint $table) {
|
||||
$table->dropColumn('rate');
|
||||
// $table->dropColumn('reject_reason');
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -434,22 +434,23 @@
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
axios
|
||||
.get('/api/booking/')
|
||||
.then((response) => {
|
||||
console.log(response)
|
||||
this.booking.amount = response.data.amount
|
||||
this.booking.bankin_amount = response.data.bia
|
||||
this.booking.timeout = response.data.timeout * 1000
|
||||
this.start = true;
|
||||
loading.close()
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
loading.close()
|
||||
this.$router.push({
|
||||
name: 'notfound'
|
||||
axios
|
||||
.get('/api/booking/')
|
||||
.then((response) => {
|
||||
this.bookingTable = response
|
||||
console.log(response)
|
||||
// this.booking.amount = response.data.amount
|
||||
// this.booking.bankin_amount = response.data.bia
|
||||
// this.booking.timeout = response.data.timeout * 1000
|
||||
// this.start = true;
|
||||
//loading.close()
|
||||
}).catch((error) => {
|
||||
// console.log(error)
|
||||
// loading.close()
|
||||
// this.$router.push({
|
||||
// name: 'notfound'
|
||||
// })
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// TODO fetch booking data on load
|
||||
|
||||
+2
-2
@@ -26,8 +26,8 @@ Route::middleware('auth:api')->get('/user', function (Request $request) {
|
||||
// return $request->user();
|
||||
//});
|
||||
Route::group(['middleware' => 'auth:api'], function () {
|
||||
Route::post('logout', 'Auth\LoginController@logout');
|
||||
|
||||
Route::post('logout', 'Auth\LoginController@logout');
|
||||
|
||||
/*Route for the booking */
|
||||
Route::get('/booking/{book_id}', 'BookingController@show');
|
||||
Route::put('/booking/{book_id}', 'BookingController@update');
|
||||
|
||||
+1
-1
@@ -17,4 +17,4 @@ Route::get('/', 'WelcomeController@index');
|
||||
|
||||
Auth::routes();
|
||||
|
||||
//Route::get('/home', 'HomeController@index')->name('home');
|
||||
Route::get('/home', 'HomeController@index')->name('home');
|
||||
|
||||
Reference in New Issue
Block a user