Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pa2d4ti06
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Juliper
pa2d4ti06
Commits
7cc7e5c2
Commit
7cc7e5c2
authored
May 26, 2017
by
Juliper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
6cf23924
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
103 deletions
+46
-103
AdminController.php
app/Http/Controllers/AdminController.php
+9
-19
CustomerController.php
app/Http/Controllers/CustomerController.php
+14
-44
HomeController.php
app/Http/Controllers/HomeController.php
+1
-0
OwnerController.php
app/Http/Controllers/OwnerController.php
+22
-40
No files found.
app/Http/Controllers/AdminController.php
View file @
7cc7e5c2
...
@@ -28,6 +28,7 @@ class AdminController extends Controller
...
@@ -28,6 +28,7 @@ class AdminController extends Controller
return
view
(
'adminlte::home'
);
return
view
(
'adminlte::home'
);
}
}
//Mengakses Daftar Pemesanan
public
function
listPesanan
(){
public
function
listPesanan
(){
$data
=
DB
::
table
(
'homestay'
)
$data
=
DB
::
table
(
'homestay'
)
...
@@ -35,11 +36,10 @@ class AdminController extends Controller
...
@@ -35,11 +36,10 @@ class AdminController extends Controller
->
select
(
'daftar_book.*'
,
'homestay.namaHomestay'
,
'homestay.owner'
)
->
select
(
'daftar_book.*'
,
'homestay.namaHomestay'
,
'homestay.owner'
)
->
get
();
->
get
();
//dd($data);
return
view
(
'adminlte::layouts.admin.dataPemesanan'
)
->
with
(
'data'
,
$data
);
return
view
(
'adminlte::layouts.admin.dataPemesanan'
)
->
with
(
'data'
,
$data
);
}
}
//Mengakses Daftar Owner
public
function
listOwner
(){
public
function
listOwner
(){
$count
=
User
::
all
()
->
where
(
'role'
,
"Owner"
)
->
count
();
$count
=
User
::
all
()
->
where
(
'role'
,
"Owner"
)
->
count
();
...
@@ -49,11 +49,13 @@ class AdminController extends Controller
...
@@ -49,11 +49,13 @@ class AdminController extends Controller
return
view
(
'adminlte::layouts.admin.listOwner'
)
->
with
(
'data'
,
$data
)
->
with
(
'count'
,
$count
);
return
view
(
'adminlte::layouts.admin.listOwner'
)
->
with
(
'data'
,
$data
)
->
with
(
'count'
,
$count
);
}
}
//Menambah owner
public
function
create
()
public
function
create
()
{
{
return
view
(
'adminlte::layouts.admin.addOwner'
);
return
view
(
'adminlte::layouts.admin.addOwner'
);
}
}
//Meyimpan Data Owner
public
function
store
(
Request
$request
)
public
function
store
(
Request
$request
)
{
{
...
@@ -89,16 +91,14 @@ class AdminController extends Controller
...
@@ -89,16 +91,14 @@ class AdminController extends Controller
$owner
->
noTelepon
=
'--'
;
$owner
->
noTelepon
=
'--'
;
$owner
->
noRekening
=
'--'
;
$owner
->
noRekening
=
'--'
;
$owner
->
foto
=
'gravatar.png'
;
$owner
->
foto
=
'gravatar.png'
;
//dd($user);
$user
->
save
();
$user
->
save
();
$owner
->
save
();
$owner
->
save
();
//dd("berhasil agan");
return
redirect
(
url
(
'admin/create'
))
->
with
(
'info'
,
'User berhasil ditambah '
);
return
redirect
(
url
(
'admin/create'
))
->
with
(
'info'
,
'User berhasil ditambah '
);
}
}
//Menampilkan Daftar RequestHomestay
public
function
RequestHomestay
(){
public
function
RequestHomestay
(){
$data
=
DB
::
table
(
'pemilikhomestay'
)
$data
=
DB
::
table
(
'pemilikhomestay'
)
...
@@ -108,11 +108,11 @@ class AdminController extends Controller
...
@@ -108,11 +108,11 @@ class AdminController extends Controller
$count
=
$data
->
count
();
$count
=
$data
->
count
();
//dd($data[0]->nama,"berhasil",$count);
return
view
(
'adminlte::layouts.admin.listPengajuan'
)
->
with
(
'data'
,
$data
)
return
view
(
'adminlte::layouts.admin.listPengajuan'
)
->
with
(
'data'
,
$data
)
->
with
(
'count'
,
$count
);
->
with
(
'count'
,
$count
);
}
}
//Melakuan Aksi Untuk memproses Permintaan Admin
public
function
UpdateRequestFasilitass
(
$id
){
public
function
UpdateRequestFasilitass
(
$id
){
//$data = DB::table('requestfasilitas')->where('id', $id)->first();
//$data = DB::table('requestfasilitas')->where('id', $id)->first();
$RF
=
RequestFasilitas
::
find
(
$id
);
$RF
=
RequestFasilitas
::
find
(
$id
);
...
@@ -135,6 +135,7 @@ class AdminController extends Controller
...
@@ -135,6 +135,7 @@ class AdminController extends Controller
return
redirect
(
'requestFasilitas'
);
return
redirect
(
'requestFasilitas'
);
}
}
//Mengakses Daftar Request Fasilitas
public
function
RequestFasilitas
(){
public
function
RequestFasilitas
(){
$data
=
DB
::
table
(
'pemilikhomestay'
)
$data
=
DB
::
table
(
'pemilikhomestay'
)
...
@@ -147,9 +148,8 @@ class AdminController extends Controller
...
@@ -147,9 +148,8 @@ class AdminController extends Controller
return
view
(
'adminlte::layouts.admin.listRequestFasilitas'
)
->
with
(
'data'
,
$data
)
->
with
(
'count'
,
$count
);
return
view
(
'adminlte::layouts.admin.listRequestFasilitas'
)
->
with
(
'data'
,
$data
)
->
with
(
'count'
,
$count
);
}
}
//Penyetujuan Pengajuan Homestay
public
function
AccPengajuanHomestay
(
$id
){
public
function
AccPengajuanHomestay
(
$id
){
//dd("masuk gan");
$RH
=
RequestHomestay
::
find
(
$id
);
$RH
=
RequestHomestay
::
find
(
$id
);
$RH
->
status
=
1
;
$RH
->
status
=
1
;
...
@@ -159,8 +159,6 @@ class AdminController extends Controller
...
@@ -159,8 +159,6 @@ class AdminController extends Controller
->
where
(
'pemilikhomestay.id'
,
'='
,
$RH
->
idPemilikHomestay
)
->
where
(
'pemilikhomestay.id'
,
'='
,
$RH
->
idPemilikHomestay
)
->
get
();
->
get
();
//dd($data[0]->nama,$data[0]->alamat);
$hs
=
new
Homestay
();
$hs
=
new
Homestay
();
$hs
->
idPemilik
=
$RH
->
idPemilikHomestay
;
$hs
->
idPemilik
=
$RH
->
idPemilikHomestay
;
$hs
->
namaHomestay
=
$RH
->
namaHomestay
;
$hs
->
namaHomestay
=
$RH
->
namaHomestay
;
...
@@ -170,7 +168,6 @@ class AdminController extends Controller
...
@@ -170,7 +168,6 @@ class AdminController extends Controller
$hs
->
harga
=
150000
;
$hs
->
harga
=
150000
;
$hs
->
status
=
'----'
;
$hs
->
status
=
'----'
;
$hs
->
save
();
$hs
->
save
();
$idHts
=
DB
::
table
(
'homestay'
)
$idHts
=
DB
::
table
(
'homestay'
)
...
@@ -178,8 +175,6 @@ class AdminController extends Controller
...
@@ -178,8 +175,6 @@ class AdminController extends Controller
->
where
(
'homestay.owner'
,
'='
,
$data
[
0
]
->
nama
)
->
where
(
'homestay.owner'
,
'='
,
$data
[
0
]
->
nama
)
->
get
();
->
get
();
//dd("sampai sini dulu",$idHts);
for
(
$i
=
1
;
$i
<=
$RH
->
jumlahKamar
;
$i
++
){
for
(
$i
=
1
;
$i
<=
$RH
->
jumlahKamar
;
$i
++
){
$km
=
new
Room
();
$km
=
new
Room
();
$km
->
idHomestay
=
$idHts
[
0
]
->
id
;
$km
->
idHomestay
=
$idHts
[
0
]
->
id
;
...
@@ -190,10 +185,5 @@ class AdminController extends Controller
...
@@ -190,10 +185,5 @@ class AdminController extends Controller
$RH
->
update
();
$RH
->
update
();
return
redirect
(
'requestHomestay'
);
return
redirect
(
'requestHomestay'
);
}
}
public
function
destroy
(
$id
)
{
//
}
}
}
app/Http/Controllers/CustomerController.php
View file @
7cc7e5c2
...
@@ -25,10 +25,10 @@ class CustomerController extends Controller
...
@@ -25,10 +25,10 @@ class CustomerController extends Controller
{
{
public
function
__construct
(){
public
function
__construct
(){
//$this->middleware('auth');
$this
->
middleware
(
'customer'
);
$this
->
middleware
(
'customer'
);
}
}
//Pembatalan Pemesanan/Pembookingan Homestay
public
function
cancelPemesanan
(
$id
){
public
function
cancelPemesanan
(
$id
){
$dataTrsaksi
=
Transaksi
::
find
(
$id
);
$dataTrsaksi
=
Transaksi
::
find
(
$id
);
...
@@ -37,10 +37,10 @@ class CustomerController extends Controller
...
@@ -37,10 +37,10 @@ class CustomerController extends Controller
DB
::
table
(
'daftar_book'
)
->
where
(
'id_transaksi'
,
'='
,
$id
)
->
delete
();
DB
::
table
(
'daftar_book'
)
->
where
(
'id_transaksi'
,
'='
,
$id
)
->
delete
();
return
redirect
(
'customerHistory'
);
return
redirect
(
'customerHistory'
);
}
}
//Pemberian/Pengiriman Feedback
public
function
sendFeedback
(
Request
$request
,
$id
){
public
function
sendFeedback
(
Request
$request
,
$id
){
if
(
Auth
::
guest
()){
if
(
Auth
::
guest
()){
dd
(
"maaf nggak bisa banf"
);
dd
(
"maaf nggak bisa banf"
);
...
@@ -56,23 +56,19 @@ class CustomerController extends Controller
...
@@ -56,23 +56,19 @@ class CustomerController extends Controller
->
where
(
'homestay.id'
,
'='
,
$id
)
->
where
(
'homestay.id'
,
'='
,
$id
)
->
get
();
->
get
();
//dd($dataPelanggan,$dataPemilik);
$feed
=
new
Feedback
();
$feed
=
new
Feedback
();
$feed
->
id_pemilikHomestay
=
$dataPemilik
[
0
]
->
idPemilik
;
$feed
->
id_pemilikHomestay
=
$dataPemilik
[
0
]
->
idPemilik
;
$feed
->
idPelanggan
=
$dataPelanggan
[
0
]
->
id
;
$feed
->
idPelanggan
=
$dataPelanggan
[
0
]
->
id
;
$feed
->
feedback
=
$request
[
'feedback'
];
$feed
->
feedback
=
$request
[
'feedback'
];
$feed
->
save
();
$feed
->
save
();
return
redirect
()
->
action
(
'CustomerController@detailhomestay'
,
[
'id'
=>
$id
]);
return
redirect
()
->
action
(
'CustomerController@detailhomestay'
,
[
'id'
=>
$id
]);
//return redirect('detailhomestay/{id}',$id);
}
}
//Upload Bukti Pembayaran
public
function
upload
(
Request
$request
,
$id
)
public
function
upload
(
Request
$request
,
$id
)
{
{
//dd("masuk agan");
$data
=
Transaksi
::
find
(
$id
);
$data
=
Transaksi
::
find
(
$id
);
if
(
$request
->
file
(
'bukti_pembayaran'
)
==
null
){
if
(
$request
->
file
(
'bukti_pembayaran'
)
==
null
){
...
@@ -84,27 +80,25 @@ class CustomerController extends Controller
...
@@ -84,27 +80,25 @@ class CustomerController extends Controller
$data
->
bukti_pembayaran
=
$fileName
;
$data
->
bukti_pembayaran
=
$fileName
;
}
}
//$cus->update();
$data
->
update
();
$data
->
update
();
return
redirect
(
'customerHistory'
);
return
redirect
(
'customerHistory'
);
}
}
//Mengakses Halaman untuk mengupload Bukti Pembayaran
public
function
bukti
(
$id
){
public
function
bukti
(
$id
){
$data
=
Transaksi
::
find
(
$id
);
$data
=
Transaksi
::
find
(
$id
);
return
view
(
'adminlte::layouts.customers.Upload'
)
->
with
(
'data'
,
$data
);
return
view
(
'adminlte::layouts.customers.Upload'
)
->
with
(
'data'
,
$data
);
}
}
//Mengakses Halaman daftar Pemesanan Pelanggan
public
function
history
(){
public
function
history
(){
$data
=
DB
::
table
(
'pelanggan'
)
$data
=
DB
::
table
(
'pelanggan'
)
->
select
(
'pelanggan.*'
)
->
select
(
'pelanggan.*'
)
->
where
(
'pelanggan.id_Akun'
,
'='
,
Auth
::
user
()
->
id
)
->
where
(
'pelanggan.id_Akun'
,
'='
,
Auth
::
user
()
->
id
)
->
get
();
->
get
();
$dataTrans
=
DB
::
table
(
'homestay'
)
$dataTrans
=
DB
::
table
(
'homestay'
)
->
join
(
'transaksi'
,
'homestay.id'
,
'='
,
'transaksi.id_homestay'
)
->
join
(
'transaksi'
,
'homestay.id'
,
'='
,
'transaksi.id_homestay'
)
->
join
(
'pemilikhomestay'
,
'homestay.idPemilik'
,
'='
,
'pemilikhomestay.id'
)
->
join
(
'pemilikhomestay'
,
'homestay.idPemilik'
,
'='
,
'pemilikhomestay.id'
)
...
@@ -112,26 +106,20 @@ class CustomerController extends Controller
...
@@ -112,26 +106,20 @@ class CustomerController extends Controller
->
where
(
'transaksi.id_pelanggan'
,
'='
,
$data
[
0
]
->
id
)
->
where
(
'transaksi.id_pelanggan'
,
'='
,
$data
[
0
]
->
id
)
->
get
();
->
get
();
// dd($dataTrans);
return
view
(
'adminlte::layouts.customers.History'
)
->
with
(
'data'
,
$dataTrans
);
return
view
(
'adminlte::layouts.customers.History'
)
->
with
(
'data'
,
$dataTrans
);
}
}
//Mengakses Profile Pelanggan
public
function
profile
(){
public
function
profile
(){
//dd("masuk agan");
//dd(Auth::user()->id);
$data
=
DB
::
table
(
'pelanggan'
)
$data
=
DB
::
table
(
'pelanggan'
)
->
select
(
'pelanggan.*'
)
->
select
(
'pelanggan.*'
)
->
where
(
'pelanggan.id_Akun'
,
'='
,
Auth
::
user
()
->
id
)
->
where
(
'pelanggan.id_Akun'
,
'='
,
Auth
::
user
()
->
id
)
->
get
();
->
get
();
//$data2 = User::find(Auth::user()->id);
//dd($data[0]);
return
view
(
'adminlte::layouts.customers.profiles'
)
->
with
(
'data'
,
$data
[
0
]);
return
view
(
'adminlte::layouts.customers.profiles'
)
->
with
(
'data'
,
$data
[
0
]);
}
}
//Menyimpan data Pelanggan disaat melakukan Pendaftaran
public
function
registerStore
(
Request
$data
){
public
function
registerStore
(
Request
$data
){
$user
=
new
User
();
$user
=
new
User
();
$user
->
name
=
$data
[
'name'
];
$user
->
name
=
$data
[
'name'
];
...
@@ -156,18 +144,17 @@ class CustomerController extends Controller
...
@@ -156,18 +144,17 @@ class CustomerController extends Controller
$cus
->
save
();
$cus
->
save
();
//$this->guard()->login($user);
return
redirect
(
'login'
);
return
redirect
(
'login'
);
}
}
//Mengakses Halaman untuk mengedit/mengubah profile
public
function
editProfile
(
$id
){
public
function
editProfile
(
$id
){
$data
=
Customer
::
find
(
$id
);
$data
=
Customer
::
find
(
$id
);
//dd($data);
return
view
(
'adminlte::layouts.customers.editprofiles'
)
->
with
(
'data'
,
$data
);
return
view
(
'adminlte::layouts.customers.editprofiles'
)
->
with
(
'data'
,
$data
);
}
}
//update Profile
public
function
updateProfile
(
Request
$request
,
$id
){
public
function
updateProfile
(
Request
$request
,
$id
){
$cus
=
Customer
::
find
(
$id
);
$cus
=
Customer
::
find
(
$id
);
$dataUs
=
User
::
find
(
Auth
::
user
()
->
id
);
$dataUs
=
User
::
find
(
Auth
::
user
()
->
id
);
...
@@ -198,6 +185,7 @@ class CustomerController extends Controller
...
@@ -198,6 +185,7 @@ class CustomerController extends Controller
return
redirect
(
'customerProfile'
);
return
redirect
(
'customerProfile'
);
}
}
//Melakukan Pembookingan Homestay
public
function
booking
(
Request
$request
){
public
function
booking
(
Request
$request
){
$this
->
validate
(
$request
,[
$this
->
validate
(
$request
,[
'tanggal'
=>
'required'
,
'tanggal'
=>
'required'
,
...
@@ -230,8 +218,6 @@ class CustomerController extends Controller
...
@@ -230,8 +218,6 @@ class CustomerController extends Controller
->
where
(
'homestay.id'
,
'='
,
$request
[
'id'
])
->
where
(
'homestay.id'
,
'='
,
$request
[
'id'
])
->
get
();
->
get
();
//dd("masuk dis ");
$homestayJumlahKamar
=
DB
::
table
(
'homestay'
)
->
select
(
'homestay.jumlahKamar'
)
->
where
(
'homestay.id'
,
'='
,
$request
[
'id'
])
->
get
();
$homestayJumlahKamar
=
DB
::
table
(
'homestay'
)
->
select
(
'homestay.jumlahKamar'
)
->
where
(
'homestay.id'
,
'='
,
$request
[
'id'
])
->
get
();
$dataBookingMulai
=
DB
::
table
(
'daftar_book'
)
$dataBookingMulai
=
DB
::
table
(
'daftar_book'
)
...
@@ -261,24 +247,17 @@ class CustomerController extends Controller
...
@@ -261,24 +247,17 @@ class CustomerController extends Controller
}
else
{
}
else
{
dd
(
'nggak boleh'
);
dd
(
'nggak boleh'
);
}
}
}
else
{
//dd('masuk aja gan');
}
}
}
}
//dd('dataBooking',$dataBooking,'dataHomestay',$dataHomestay);
$dataPelanggan
=
DB
::
table
(
'users'
)
$dataPelanggan
=
DB
::
table
(
'users'
)
->
join
(
'pelanggan'
,
'users.id'
,
'='
,
'pelanggan.id_Akun'
)
->
join
(
'pelanggan'
,
'users.id'
,
'='
,
'pelanggan.id_Akun'
)
->
select
(
'pelanggan.id'
,
'pelanggan.nama'
)
->
select
(
'pelanggan.id'
,
'pelanggan.nama'
)
->
where
(
'users.id'
,
'='
,
Auth
::
user
()
->
id
)
->
where
(
'users.id'
,
'='
,
Auth
::
user
()
->
id
)
->
get
();
->
get
();
//dd($dataHomestay,$dataPelanggan);
$time
=
explode
(
'-'
,
$request
[
'tanggal'
]);
$time
=
explode
(
'-'
,
$request
[
'tanggal'
]);
//dd($time[1]+2);
if
(
$time
[
1
]
==
2
){
if
(
$time
[
1
]
==
2
){
$time
[
2
]
+=
$request
[
'jumlah_hari'
];
$time
[
2
]
+=
$request
[
'jumlah_hari'
];
if
(
$time
[
2
]
>
28
){
if
(
$time
[
2
]
>
28
){
...
@@ -309,12 +288,8 @@ class CustomerController extends Controller
...
@@ -309,12 +288,8 @@ class CustomerController extends Controller
$time
[
2
]
-=
1
;
$time
[
2
]
-=
1
;
}
}
}
}
$baru
=
join
(
'-'
,
$time
);
$baru
=
join
(
'-'
,
$time
);
//dd($request['tanggal'],$baru,$request['jumlah_hari']);
//Insert Table Transaksi
$trans
=
new
Transaksi
();
$trans
=
new
Transaksi
();
$trans
->
id_pelanggan
=
$dataPelanggan
[
0
]
->
id
;
$trans
->
id_pelanggan
=
$dataPelanggan
[
0
]
->
id
;
$trans
->
id_homestay
=
$request
[
'id'
];
$trans
->
id_homestay
=
$request
[
'id'
];
...
@@ -332,9 +307,7 @@ class CustomerController extends Controller
...
@@ -332,9 +307,7 @@ class CustomerController extends Controller
->
where
(
'transaksi.tanggal_mulai'
,
'='
,
$request
[
'tanggal'
])
->
where
(
'transaksi.tanggal_mulai'
,
'='
,
$request
[
'tanggal'
])
->
where
(
'transaksi.tanggal_berakhir'
,
'='
,
$baru
)
->
where
(
'transaksi.tanggal_berakhir'
,
'='
,
$baru
)
->
get
();
->
get
();
//Insert Table Daftar Booking
//Insert Table Daftar Booking
$lb
->
homestay
=
$request
[
'id'
];
$lb
->
homestay
=
$request
[
'id'
];
$lb
->
id_transaksi
=
$dataTrans
[
0
]
->
id
;
$lb
->
id_transaksi
=
$dataTrans
[
0
]
->
id
;
...
@@ -344,7 +317,6 @@ class CustomerController extends Controller
...
@@ -344,7 +317,6 @@ class CustomerController extends Controller
$lb
->
tanggal_berakhir
=
$baru
;
$lb
->
tanggal_berakhir
=
$baru
;
//Save
//Save
$lb
->
save
();
$lb
->
save
();
Nexmo
::
message
()
->
send
([
Nexmo
::
message
()
->
send
([
...
@@ -353,9 +325,7 @@ class CustomerController extends Controller
...
@@ -353,9 +325,7 @@ class CustomerController extends Controller
'text'
=>
'Hi ini hanya sebuah test no more'
'text'
=>
'Hi ini hanya sebuah test no more'
]);
]);
return
redirect
(
'customerHistory'
);
return
redirect
(
'customerHistory'
);
}
}
...
...
app/Http/Controllers/HomeController.php
View file @
7cc7e5c2
...
@@ -24,6 +24,7 @@ class HomeController extends Controller
...
@@ -24,6 +24,7 @@ class HomeController extends Controller
public
function
__construct
()
public
function
__construct
()
{
{
$this
->
middleware
(
'auth'
);
$this
->
middleware
(
'auth'
);
$this
->
middleware
(
'owner'
);
}
}
/**
/**
...
...
app/Http/Controllers/OwnerController.php
View file @
7cc7e5c2
...
@@ -27,12 +27,11 @@ class OwnerController extends Controller
...
@@ -27,12 +27,11 @@ class OwnerController extends Controller
return
view
(
'adminlte::layouts.owner.home'
);
return
view
(
'adminlte::layouts.owner.home'
);
}
}
//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
();
$user
=
User
::
where
(
'name'
,
$owner
->
nama
)
->
first
();
$user
=
User
::
where
(
'name'
,
$owner
->
nama
)
->
first
();
//dd("masuk agan",$id,$request['picture'],$request['nama']);
if
(
$request
[
'nama'
]
==
""
){
if
(
$request
[
'nama'
]
==
""
){
$user
->
name
=
$owner
->
nama
;
$user
->
name
=
$owner
->
nama
;
}
else
{
}
else
{
...
@@ -57,19 +56,17 @@ class OwnerController extends Controller
...
@@ -57,19 +56,17 @@ class OwnerController extends Controller
$user
->
update
();
$user
->
update
();
$owner
->
update
();
$owner
->
update
();
//$data = DB::table('pemilikhomestay')->where('nama', $request['nama'])->first();
//dd('succes Gan');
return
redirect
(
'profile'
);
return
redirect
(
'profile'
);
}
}
//Mengakses Halaman untuk Melakukan edit Profile
public
function
profileEdit
(
$id
){
public
function
profileEdit
(
$id
){
$data
=
Owner
::
find
(
$id
);
//all()->where('id_Owner',$id);
$data
=
Owner
::
find
(
$id
);
//dd($data);
return
view
(
'adminlte::layouts.owner.updateProfil'
)
->
with
(
'data'
,
$data
);
return
view
(
'adminlte::layouts.owner.updateProfil'
)
->
with
(
'data'
,
$data
);
}
}
//Mengakses Halaman profile
public
function
profile
(){
public
function
profile
(){
$users
=
User
::
find
(
Auth
::
user
()
->
id
);
$users
=
User
::
find
(
Auth
::
user
()
->
id
);
...
@@ -78,6 +75,7 @@ class OwnerController extends Controller
...
@@ -78,6 +75,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
public
function
feddback
(){
public
function
feddback
(){
$dataPemilik
=
DB
::
table
(
'pemilikhomestay'
)
$dataPemilik
=
DB
::
table
(
'pemilikhomestay'
)
->
select
(
'pemilikhomestay.id'
)
->
select
(
'pemilikhomestay.id'
)
...
@@ -90,12 +88,11 @@ class OwnerController extends Controller
...
@@ -90,12 +88,11 @@ class OwnerController extends Controller
->
where
(
'feedback.id_pemilikHomestay'
,
'='
,
$dataPemilik
[
0
]
->
id
)
->
where
(
'feedback.id_pemilikHomestay'
,
'='
,
$dataPemilik
[
0
]
->
id
)
->
get
();
->
get
();
//dd($dataFeedback);
return
view
(
'adminlte::layouts.owner.listfeedback'
)
->
with
(
'data'
,
$dataFeedback
);
return
view
(
'adminlte::layouts.owner.listfeedback'
)
->
with
(
'data'
,
$dataFeedback
);
}
}
//Menyimpan Data Update Homestay
public
function
updateHomestay
(
Request
$request
,
$id
){
public
function
updateHomestay
(
Request
$request
,
$id
){
$this
->
validate
(
$request
,[
$this
->
validate
(
$request
,[
'namaUpdate'
=>
'required|string'
,
'namaUpdate'
=>
'required|string'
,
'alamatUpdate'
=>
'required|string'
,
'alamatUpdate'
=>
'required|string'
,
...
@@ -134,8 +131,8 @@ class OwnerController extends Controller
...
@@ -134,8 +131,8 @@ class OwnerController extends Controller
return
redirect
(
'updateHomestay'
);
return
redirect
(
'updateHomestay'
);
}
}
//Mengakses Halaman Update Homestay
public
function
update
(){
public
function
update
(){
$dataPemilik
=
DB
::
table
(
'pemilikhomestay'
)
$dataPemilik
=
DB
::
table
(
'pemilikhomestay'
)
->
select
(
'pemilikhomestay.id'
)
->
select
(
'pemilikhomestay.id'
)
->
where
(
'pemilikhomestay.id_Akun'
,
'='
,
Auth
::
user
()
->
id
)
->
where
(
'pemilikhomestay.id_Akun'
,
'='
,
Auth
::
user
()
->
id
)
...
@@ -146,11 +143,10 @@ class OwnerController extends Controller
...
@@ -146,11 +143,10 @@ class OwnerController extends Controller
->
where
(
'homestay.idPemilik'
,
'='
,
$dataPemilik
[
0
]
->
id
)
->
where
(
'homestay.idPemilik'
,
'='
,
$dataPemilik
[
0
]
->
id
)
->
get
();
->
get
();
//dd($dataPemilik[0]->id,$dataHomestay[0]);
return
view
(
'adminlte::layouts.owner.UpdateHomestay'
)
->
with
(
'data'
,
$dataHomestay
[
0
]);
return
view
(
'adminlte::layouts.owner.UpdateHomestay'
)
->
with
(
'data'
,
$dataHomestay
[
0
]);
}
}
//Melakukan Konfirmasi Pemesanan
public
function
konfirmasiPemesanan
(
Request
$request
,
$id
){
public
function
konfirmasiPemesanan
(
Request
$request
,
$id
){
$data
=
Transaksi
::
find
(
$id
);
$data
=
Transaksi
::
find
(
$id
);
...
@@ -168,9 +164,8 @@ class OwnerController extends Controller
...
@@ -168,9 +164,8 @@ class OwnerController extends Controller
return
redirect
(
'pesanan'
);
return
redirect
(
'pesanan'
);
}
}
//Mengakses Daftar Booking Homestay
public
function
listOfBook
(){
public
function
listOfBook
(){
$dataPemilik
=
DB
::
table
(
'pemilikhomestay'
)
$dataPemilik
=
DB
::
table
(
'pemilikhomestay'
)
->
select
(
'pemilikhomestay.id'
)
->
select
(
'pemilikhomestay.id'
)
->
where
(
'pemilikhomestay.id_Akun'
,
'='
,
Auth
::
user
()
->
id
)
->
where
(
'pemilikhomestay.id_Akun'
,
'='
,
Auth
::
user
()
->
id
)
...
@@ -187,12 +182,11 @@ class OwnerController extends Controller
...
@@ -187,12 +182,11 @@ class OwnerController extends Controller
->
select
(
'daftar_book.*'
)
->
select
(
'daftar_book.*'
)
->
where
(
'daftar_book.homestay'
,
'='
,
$dataHomestay
[
0
]
->
id
)
->
where
(
'daftar_book.homestay'
,
'='
,
$dataHomestay
[
0
]
->
id
)
->
get
();
->
get
();
//dd('mas',$dataPemilik,$dataHomestay);
//dd('sampai disini dulu');
return
view
(
'adminlte::layouts.owner.ListBooking'
)
->
with
(
'data'
,
$dataListOfBook
)
->
with
(
'count'
,
$dataListOfBook
->
count
());
return
view
(
'adminlte::layouts.owner.ListBooking'
)
->
with
(
'data'
,
$dataListOfBook
)
->
with
(
'count'
,
$dataListOfBook
->
count
());
}
}
//Melakukan Penambahan Boking secara Manual
public
function
addBookManual
(
Request
$request
){
public
function
addBookManual
(
Request
$request
){
$lb
=
new
ListBook
();
$lb
=
new
ListBook
();
...
@@ -238,8 +232,8 @@ class OwnerController extends Controller
...
@@ -238,8 +232,8 @@ class OwnerController extends Controller
}
}
//Melakukan Update Kamar
public
function
updateRoom
(
Request
$request
,
$id
){
public
function
updateRoom
(
Request
$request
,
$id
){
$this
->
validate
(
$request
,[
$this
->
validate
(
$request
,[
'jumlah_bed'
=>
'required|numeric'
,
'jumlah_bed'
=>
'required|numeric'
,
],[
],[
...
@@ -266,12 +260,14 @@ class OwnerController extends Controller
...
@@ -266,12 +260,14 @@ class OwnerController extends Controller
return
redirect
(
'daftarKamar'
)
->
with
(
'message'
,
'Update Kamar Sukses!'
);
return
redirect
(
'daftarKamar'
)
->
with
(
'message'
,
'Update Kamar Sukses!'
);
}
}
//Mengakses Halaman Edit Room
public
function
editRoom
(
$id
){
public
function
editRoom
(
$id
){
$dataKamar
=
Room
::
find
(
$id
);
$dataKamar
=
Room
::
find
(
$id
);
return
view
(
'adminlte::layouts.owner.EditRoom'
)
->
with
(
'data'
,
$dataKamar
);
return
view
(
'adminlte::layouts.owner.EditRoom'
)
->
with
(
'data'
,
$dataKamar
);
}
}
//Mengakses Halaman Daftar Kamar
public
function
daftarKamar
(){
public
function
daftarKamar
(){
$dataPemilik
=
DB
::
table
(
'pemilikhomestay'
)
$dataPemilik
=
DB
::
table
(
'pemilikhomestay'
)
...
@@ -289,6 +285,7 @@ class OwnerController extends Controller
...
@@ -289,6 +285,7 @@ class OwnerController extends Controller
return
view
(
'adminlte::layouts.owner.listRoom'
)
->
with
(
'data'
,
$data
)
->
with
(
'count'
,
$data
->
count
());
return
view
(
'adminlte::layouts.owner.listRoom'
)
->
with
(
'data'
,
$data
)
->
with
(
'count'
,
$data
->
count
());
}
}
//Mengakses Halaman Daftar Transaksi
public
function
listTransaction
(){
public
function
listTransaction
(){
$dataPel
=
DB
::
table
(
'pemilikhomestay'
)
$dataPel
=
DB
::
table
(
'pemilikhomestay'
)
...
@@ -307,12 +304,13 @@ class OwnerController extends Controller
...
@@ -307,12 +304,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
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
public
function
storeRequest
(
Request
$request
){
public
function
storeRequest
(
Request
$request
){
$this
->
validate
(
$request
,[
$this
->
validate
(
$request
,[
'namaRequestFasilitas'
=>
'required|string'
,
'namaRequestFasilitas'
=>
'required|string'
,
'deskripsi'
=>
'required|string'
,
'deskripsi'
=>
'required|string'
,
...
@@ -352,10 +350,12 @@ class OwnerController extends Controller
...
@@ -352,10 +350,12 @@ class OwnerController extends Controller
}
}
//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
public
function
storePengajuan
(
Request
$request
){
public
function
storePengajuan
(
Request
$request
){
$this
->
validate
(
$request
,[
$this
->
validate
(
$request
,[
...
@@ -385,6 +385,7 @@ class OwnerController extends Controller
...
@@ -385,6 +385,7 @@ class OwnerController extends Controller
dd
(
$request
[
'namaHomestay'
],
$request
[
'jumlahKamar'
]);
dd
(
$request
[
'namaHomestay'
],
$request
[
'jumlahKamar'
]);
}
}
//Melihat Daftar Pengajuan Homestay
public
function
listPengajuan
(){
public
function
listPengajuan
(){
$idPemilik
=
DB
::
table
(
'users'
)
$idPemilik
=
DB
::
table
(
'users'
)
...
@@ -392,7 +393,7 @@ class OwnerController extends Controller
...
@@ -392,7 +393,7 @@ 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);
$data
=
DB
::
table
(
'pengajuan_homestay'
)
$data
=
DB
::
table
(
'pengajuan_homestay'
)
->
join
(
'pemilikhomestay'
,
'pengajuan_homestay.idPemilikHomestay'
,
'='
,
'pemilikhomestay.id'
)
->
join
(
'pemilikhomestay'
,
'pengajuan_homestay.idPemilikHomestay'
,
'='
,
'pemilikhomestay.id'
)
->
select
(
'pemilikhomestay.nama'
,
'pengajuan_homestay.*'
)
->
select
(
'pemilikhomestay.nama'
,
'pengajuan_homestay.*'
)
...
@@ -404,6 +405,7 @@ class OwnerController extends Controller
...
@@ -404,6 +405,7 @@ class OwnerController extends Controller
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
public
function
listPengajuanFasilitas
(){
public
function
listPengajuanFasilitas
(){
$idPemilik
=
DB
::
table
(
'users'
)
$idPemilik
=
DB
::
table
(
'users'
)
->
join
(
'pemilikhomestay'
,
'users.id'
,
'='
,
'pemilikhomestay.id_Akun'
)
->
join
(
'pemilikhomestay'
,
'users.id'
,
'='
,
'pemilikhomestay.id_Akun'
)
...
@@ -422,24 +424,4 @@ class OwnerController extends Controller
...
@@ -422,24 +424,4 @@ class OwnerController extends Controller
return
view
(
'adminlte::layouts.owner.ListPengajuanFasilitas'
)
->
with
(
'data'
,
$data
)
->
with
(
'count'
,
$count
);
return
view
(
'adminlte::layouts.owner.ListPengajuanFasilitas'
)
->
with
(
'data'
,
$data
)
->
with
(
'count'
,
$count
);
}
}
// //coba chart
// public function chartjs()
// {
// $viewer = View::select(DB::raw("SUM(numberofview) as count"))
// ->orderBy("created_at")
// ->groupBy(DB::raw("year(created_at)"))
// ->get()->toArray();
// $viewer = array_column($viewer, 'count');
//
// $click = Click::select(DB::raw("SUM(numberofclick) as count"))
// ->orderBy("created_at")
// ->groupBy(DB::raw("year(created_at)"))
// ->get()->toArray();
// $click = array_column($click, 'count');
//
// return view('chartjs')
// ->with('viewer',json_encode($viewer,JSON_NUMERIC_CHECK))
// ->with('click',json_encode($click,JSON_NUMERIC_CHECK));
// }
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment