Commit 1da5d4f1 by Juliper

no message

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