Commit 4f242463 by Juliper

update Homestay

parent 4246ad2a
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Homestay;
use App\ListBook; use App\ListBook;
use App\RequestFasilitas; use App\RequestFasilitas;
use App\RequestHomestay; use App\RequestHomestay;
...@@ -22,6 +23,50 @@ class OwnerController extends Controller ...@@ -22,6 +23,50 @@ class OwnerController extends Controller
} }
public function updateHomestay(Request $request,$id){
$updateHomestay = Homestay::find($id);
$updateHomestay->namaHomestay = $request['namaUpdate'];
$updateHomestay->alamat = $request['alamatUpdate'];
$updateHomestay->harga = $request['hargaUpdate'];
if ($updateHomestay->fasilitas == null){
$updateHomestay->fasilitas = $updateHomestay->fasilitas;
}else{
$updateHomestay->fasilitas = $request['fasilitasUpdate'];
}
if($request->file('gambar')==null){
$updateHomestay->gambar = $updateHomestay->gambar;
}else{
$file = $request->file('gambar');
$fileName = $file->getClientOriginalName();
$request->file('gambar')->move("img/",$fileName);
$updateHomestay->gambar = $fileName;
}
$updateHomestay->update();
return redirect('updateHomestay');
}
public function update(){
$dataPemilik = DB::table('pemilikhomestay')
->select('pemilikhomestay.id')
->where('pemilikhomestay.id_Akun','=',Auth::user()->id)
->get();
$dataHomestay = DB::table('homestay')
->select('homestay.*')
->where('homestay.idPemilik','=',$dataPemilik[0]->id)
->get();
//dd($dataPemilik[0]->id,$dataHomestay[0]);
return view('adminlte::layouts.owner.UpdateHomestay')->with('data',$dataHomestay[0]);
}
public function konfirmasiPemesanan(Request $request,$id){ public function konfirmasiPemesanan(Request $request,$id){
$data = Transaksi::find($id); $data = Transaksi::find($id);
......
...@@ -28,15 +28,16 @@ ...@@ -28,15 +28,16 @@
</div> </div>
<div class="box-body"> <div class="box-body">
<form action="{{ url('reqFasilitas') }}" method="post" enctype="multipart/form-data"> <form action="{{ url('updateHomestay/'.$data->id) }}" method="post" enctype="multipart/form-data">
<input type="hidden" name="_token" value="{{ csrf_token() }}"> <input type="hidden" name="_method" value="PUT">
{{csrf_field()}}
<div class="form-group"> <div class="form-group">
<label> Nama Homestay </label> <label> Nama Homestay </label>
<div class="input-group"> <div class="input-group">
<div class="input-group-addon"> <div class="input-group-addon">
<i class="fa fa-bookmark"></i> <i class="fa fa-bookmark"></i>
</div> </div>
<input type="text" class="form-control" placeholder="Nama Request Fasilitas" name="namaRequestFasilitas"/> <input type="text" class="form-control" placeholder="Nama Request Fasilitas" name="namaUpdate" value="{{$data->namaHomestay}}"/>
</div> </div>
</div> </div>
...@@ -46,7 +47,7 @@ ...@@ -46,7 +47,7 @@
<div class="input-group-addon"> <div class="input-group-addon">
<i class="fa fa-building"></i> <i class="fa fa-building"></i>
</div> </div>
<input type="text" class="form-control" placeholder="Nama Request Fasilitas" name="namaRequestFasilitas"/> <input type="text" class="form-control" placeholder="Nama Request Fasilitas" name="alamatUpdate" value="{{$data->alamat}}"/>
</div> </div>
</div> </div>
...@@ -56,7 +57,7 @@ ...@@ -56,7 +57,7 @@
<div class="input-group-addon"> <div class="input-group-addon">
<i class="fa fa-dollar"></i> <i class="fa fa-dollar"></i>
</div> </div>
<input type="text" class="form-control" placeholder="Nama Request Fasilitas" name="namaRequestFasilitas"/> <input type="text" class="form-control" value="{{$data->harga}}" placeholder="Nama Request Fasilitas" name="hargaUpdate"/>
</div> </div>
</div> </div>
...@@ -66,7 +67,7 @@ ...@@ -66,7 +67,7 @@
<div class="input-group-addon"> <div class="input-group-addon">
<i class="fa fa-newspaper-o"></i> <i class="fa fa-newspaper-o"></i>
</div> </div>
<textarea class="form-control" placeholder="Deskripsi" name="deskripsi" style="height:200px;"> </textarea> <textarea class="form-control" value="{{$data->fasilitas}}" placeholder="Deskripsi" name="fasilitasUpdate" style="height:200px;"> </textarea>
</div> </div>
</div> </div>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
<ul class="treeview-menu" style="display : none;"> <ul class="treeview-menu" style="display : none;">
<li><a href="{{url('daftarKamar')}}"><i class='fa fa-list'></i> <span>Daftar Kamar</span></a></li> <li><a href="{{url('daftarKamar')}}"><i class='fa fa-list'></i> <span>Daftar Kamar</span></a></li>
<li><a href="{{url('pengajuanHomestay')}}"><i class='fa fa-external-link-square'></i> <span> Pengajuan Homestay </span></a></li> <li><a href="{{url('pengajuanHomestay')}}"><i class='fa fa-external-link-square'></i> <span> Pengajuan Homestay </span></a></li>
<li><a href="{{url('UpdateHomestay')}}"><i class='fa fa-list'></i> <span>Update Homestay</span></a></li> <li><a href="{{url('updateHomestay')}}"><i class='fa fa-list'></i> <span>Update Homestay</span></a></li>
</ul> </ul>
</li> </li>
......
...@@ -94,7 +94,10 @@ Route::put('listPengajuanHomestay/{id}','AdminController@AccPengajuanHomestay'); ...@@ -94,7 +94,10 @@ Route::put('listPengajuanHomestay/{id}','AdminController@AccPengajuanHomestay');
Route::resource('profile','ProfileController'); Route::resource('profile','ProfileController');
Route::get('reqFasilitas','OwnerController@requestFasilitas'); Route::get('reqFasilitas','OwnerController@requestFasilitas');
Route::post('reqFasilitas','OwnerController@storeRequest'); Route::post('reqFasilitas','OwnerController@storeRequest');
Route::get('updateHomestay','OwnerController@update');
Route::put('updateHomestay/{id}','OwnerController@updateHomestay');
Route::get('UpdateHomestay', function(){
/*Route::get('UpdateHomestay', function(){
return view('adminlte::layouts.owner.UpdateHomestay'); return view('adminlte::layouts.owner.UpdateHomestay');
}); });*/
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