Commit 040ca38b by Palti Sinaga

no message

parents 964b6449 b5959e5b
......@@ -169,6 +169,10 @@ class CustomerController extends Controller
}
public function booking(Request $request){
if(Auth::guest()){
dd("you must have account");
}
$lb = new ListBook();
$dataHomestay = DB::table('homestay')
......@@ -185,7 +189,7 @@ class CustomerController extends Controller
->get();
$dataBookingBerakhir = DB::table('daftar_book')
->select('daftar_book.*')
->where('daftar_book.tanggal_mulai','=',$request['tanggal'])
->where('daftar_book.tanggal_berakhir','=',$request['tanggal'])
->get();
if($dataBookingMulai->count() > 0){
......@@ -199,7 +203,16 @@ class CustomerController extends Controller
}
}else{
echo ('langsung aja');
if($dataBookingBerakhir->count() > 0){
$currentJumlahKamar2 = $homestayJumlahKamar[0]->jumlahKamar - $dataBookingBerakhir[0]->jumlah_kamar;
if($currentJumlahKamar2 >= $request['jumlah_kamar']){
dd('boleh aja agan');
}else{
dd('nggak boleh');
}
}else{
dd('masuk aja gan');
}
}
......@@ -213,7 +226,6 @@ class CustomerController extends Controller
->get();
//dd($dataHomestay,$dataPelanggan);
$time = explode('-', $request['tanggal']);
$time[2] +=$request['jumlah_hari'];
......
......@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\ListBook;
use App\RequestFasilitas;
use App\RequestHomestay;
use App\Room;
......@@ -20,6 +21,24 @@ class OwnerController extends Controller
}
public function addBook(Request $request){
$lb = new ListBook();
$dataPemilik = DB::table('pemilikhomestay')
->select('pemilikhomestay.id')
->where('pemilikhomestay.id_Akun','=',Auth::user()->id)
->get();
$dataHomestay = DB::table('homestay')
->join('pemilikhomestay','homestay.idPemilik','pemilikhomestay.id')
->select('homestay.id')
->where('homestay.id_Akun','=',$dataPemilik[0]->id)
->get();
}
public function updateRoom(Request $request, $id){
$dataKamar = Room::find($id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment