Commit 1da5d4f1 by Juliper

no message

parent 063c10bc
......@@ -83,16 +83,25 @@ class AdminController extends Controller
$user->email = $data['email'];
$user->password = bcrypt($data['password']);
$user->role = 'Owner';
$user->save();
$dataPemilik = DB::table('users')
->select('users.id')
->where('username','=',$data['username'])
->get();
//dd($dataPemilik->id);
$owner = new Owner();
$owner->nama = $data['name'];
$owner->id_akun = $dataPemilik[0]->id;
$owner->alamat = '--';
$owner->pekerjaan = '--';
$owner->no_telepon = '--';
$owner->no_rekening = '--';
$owner->foto = 'gravatar.png';
$user->save();
$owner->save();
return redirect(url('admin/create'))->with('info', 'User berhasil ditambah ');
}
......@@ -153,15 +162,15 @@ class AdminController extends Controller
$data = DB::table('pengajuan_homestay')
->join('pemilikhomestay','pemilikhomestay.id','=','pengajuan_homestay.id_pemilik_homestay')
->select('pemilikhomestay.nama','pemilikhomestay.alamat')
->where('pemilikhomestay.id','=',$RH->idPemilikHomestay)
->where('pemilikhomestay.id','=',$RH->id_pemilik_homestay)
->get();
//dd($data);
$hs = new Homestay();
$hs->id_pemilik = $RH->idPemilikHomestay;
$hs->nama_homestay = $RH->namaHomestay;
$hs->id_pemilik = $RH->id_pemilik_homestay;
$hs->nama_homestay = $RH->nama_homestay;
$hs->owner = $data[0]->nama ;
$hs->alamat = $data[0]->alamat;
$hs->jumlah_kamar = $RH->jumlahKamar;
$hs->jumlah_kamar = $RH->jumlah_kamar;
$hs->harga = 150000;
$hs->status='----';
......
......@@ -27,6 +27,7 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.home');
}
//Menyimpan Data untuk di update
public function updateProfil(Request $request,$id){
$owner = Owner::where('id',$id)->first();
......@@ -59,6 +60,7 @@ class OwnerController extends Controller
return redirect('profile');
}
//Mengakses Halaman untuk Melakukan edit Profile
public function profileEdit($id){
$data = Owner::find($id);
......@@ -66,6 +68,7 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.updateProfil')->with('data',$data);
}
//Mengakses Halaman profile
public function profile(){
......@@ -75,6 +78,7 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.profil')->with('data',$data);
}
//Mengakses Halaman daftar Feedback
public function feddback(){
$dataPemilik = DB::table('pemilikhomestay')
......@@ -91,6 +95,7 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.listfeedback')->with('data',$dataFeedback);
}
//Menyimpan Data Update Homestay
public function updateHomestay(Request $request,$id){
$this->validate($request,[
......@@ -131,6 +136,7 @@ class OwnerController extends Controller
return redirect('updateHomestay');
}
//Mengakses Halaman Update Homestay
public function update(){
$dataPemilik = DB::table('pemilikhomestay')
......@@ -142,7 +148,7 @@ class OwnerController extends Controller
->select('homestay.*')
->where('homestay.id_pemilik','=',$dataPemilik[0]->id)
->get();
//dd($dataHomestay[0]);
return view('adminlte::layouts.owner.UpdateHomestay')->with('data',$dataHomestay[0]);
}
......@@ -304,11 +310,13 @@ class OwnerController extends Controller
return view('adminlte::layouts.owner.listPesanan')->with('data',$data)->with('count',$data->count());
}
//Mengakses Halaman untuk melakukan Request Fasilitas
public function requestFasilitas(){
return view('adminlte::layouts.owner.RequestFasilitas')->with('message', 'Request Fasilitas Berhasil Dikirim!');
}
//Menyimpan Data Request Fasilitas
public function storeRequest(Request $request){
$this->validate($request,[
......@@ -350,11 +358,13 @@ class OwnerController extends Controller
}
//Mengakses Halaman untuk melakukan Pengajuan
public function pengajuan(){
return view('adminlte::layouts.owner.PengajuanHomestay');
}
//Menyimpan Data Pengajuan
public function storePengajuan(Request $request){
......@@ -375,16 +385,17 @@ class OwnerController extends Controller
$data = new RequestHomestay();
$data->id_pemili_homestay = $idPemilik[0]->id;
$data->id_pemilik_homestay = $idPemilik[0]->id;
$data->nama_homestay = $request['namaHomestay'];
$data->jumlah_kamar = $request['jumlahKamar'];
$data->status = 0;
$data->save();
dd($request['namaHomestay'],$request['jumlahKamar']);
return redirect('listPengajuan');
}
//Melihat Daftar Pengajuan Homestay
public function listPengajuan(){
......@@ -393,18 +404,19 @@ class OwnerController extends Controller
->select('pemilikhomestay.id')
->where('users.id', '=', Auth::user()->id)
->get();
//dd($idPemilik,Auth::user()->id);
$data = DB::table('pengajuan_homestay')
->join('pemilikhomestay','pengajuan_homestay.id_pemilik_homestay','=','pemilikhomestay.id')
->select('pemilikhomestay.nama','pengajuan_homestay.*')
->where('pengajuan_homestay.id_pemilik_homestay','=',$idPemilik[0]->id)
->get();
//dd('masuk');
$count = $data->count();
return view('adminlte::layouts.owner.ListPengajuanHomestay')->with('data',$data)->with('count',$count);
}
//Melihat Daftar Pengajuan Fasilitas
public function listPengajuanFasilitas(){
$idPemilik = DB::table('users')
......
......@@ -30,29 +30,6 @@
<!-- /.info-box-content -->
</div>
<table class="table table-striped">
<tr>
<th>Pengaju</th>
<th>Nama Homestay</th>
<td>Jumlah Kamar</td>
<td>Status</td>
</tr>
@foreach($data as $a)
<tr>
<td>{{$a->nama}}</td>
<td>{{$a->nama_homestay}}</td>
<td>{{$a->jumlah_kamar}}</td>
<td>@if($a->status==0) Sedang Menunggu
@elseif($a->status==1) Diterima
@elseif($a->status==2) Ditolak
@endif
</td>
</tr>
@endforeach
</table>
<!-- /.info-box -->
<br>
</div>
......@@ -66,8 +43,8 @@
@foreach($data as $a)
<tr>
<td>{{$a->nama}}</td>
<td>{{$a->namaHomestay}}</td>
<td>{{$a->jumlahKamar}}</td>
<td>{{$a->nama_homestay}}</td>
<td>{{$a->jumlah_kamar}}</td>
<td>@if($a->status==0) Sedang Menunggu
@elseif($a->status==1) Diterima
@elseif($a->status==2) Ditolak
......
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