Commit 65128518 by Juliper

no message

parent 571fff5a
......@@ -22,6 +22,14 @@ class CustomerController extends Controller
public function cancelPemesanan($id){
$dataTrsaksi = Transaksi::find($id);
$dataTrsaksi->delete();
DB::table('daftar_book')->where('id_transaksi', '=', $id)->delete();
return redirect('customerHistory');
}
public function sendFeedback(Request $request, $id){
......@@ -330,15 +338,25 @@ class CustomerController extends Controller
$trans->total_pembayaran = $request['jumlah_kamar'] * $dataHomestay[0]->harga;
$trans->status = 0;
$trans->save();
$dataTrans = DB::table('transaksi')
->select('transaksi.id')
->where('transaksi.tanggal_mulai','=',$request['tanggal'])
->where('transaksi.tanggal_berakhir','=',$baru)
->get();
//Insert Table Daftar Booking
$lb->homestay = $request['id'];
$lb->id_transaksi = $dataTrans[0]->id;
$lb->nama_pemesan = $dataPelanggan[0]->nama;
$lb->jumlah_kamar = $request['jumlah_kamar'];
$lb->tanggal_mulai = $request['tanggal'] ;
$lb->tanggal_berakhir = $baru;
//Save
$trans->save();
$lb->save();
return redirect()->action('CustomerController@detailhomestay', ['id' => $request['id']]);
......
......@@ -38,7 +38,11 @@
<a href="{{url('buktipembayaran/'.$a->id)}}">Upload Bukti</a>
</td>
<td>
<button type="button" class="btn btn-danger" > Cancel </button>
<form action="{{url('batalkanPemesanan/'.$a->id)}}" method="POST">
{{csrf_field()}}
<input type="hidden" name="_method" value="DELETE">
<button type="submit" class="btn btn-danger">Hapus</button>
</form>
</td>
</tr>
@endforeach
......
......@@ -96,7 +96,7 @@ Route::get('reqFasilitas','OwnerController@requestFasilitas');
Route::post('reqFasilitas','OwnerController@storeRequest');
Route::get('updateHomestay','OwnerController@update');
Route::put('updateHomestay/{id}','OwnerController@updateHomestay');
Route::delete('batalkanPemesanan/{id}','CutomerController@cancelPemesanan');
Route::delete('batalkanPemesanan/{id}','CustomerController@cancelPemesanan');
/*Route::get('UpdateHomestay', function(){
......
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