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
7bb4923c
Commit
7bb4923c
authored
May 26, 2017
by
Palti Sinaga
Browse files
Options
Browse Files
Download
Plain Diff
commit
parents
8b730aad
683b24a6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
35 deletions
+79
-35
RegisterController.php
app/Http/Controllers/Auth/RegisterController.php
+2
-0
CustomerController.php
app/Http/Controllers/CustomerController.php
+38
-34
GuestController.php
app/Http/Controllers/GuestController.php
+27
-0
p2d4ti06_test.sql
p2d4ti06_test.sql
+0
-0
profiles.blade.php
...iews/vendor/adminlte/layouts/customers/profiles.blade.php
+6
-0
Homestay.blade.php
...es/views/vendor/adminlte/layouts/pages/Homestay.blade.php
+5
-0
web.php
routes/web.php
+1
-1
No files found.
app/Http/Controllers/Auth/RegisterController.php
View file @
7bb4923c
...
...
@@ -35,6 +35,7 @@ class RegisterController extends Controller
*/
public
function
showRegistrationForm
()
{
dd
(
'masyk diads'
);
return
view
(
'adminlte::auth.register'
);
}
...
...
@@ -52,6 +53,7 @@ class RegisterController extends Controller
*/
public
function
__construct
()
{
$this
->
middleware
(
'guest'
);
}
...
...
app/Http/Controllers/CustomerController.php
View file @
7bb4923c
...
...
@@ -119,34 +119,6 @@ class CustomerController extends Controller
return
view
(
'adminlte::layouts.customers.profiles'
)
->
with
(
'data'
,
$data
[
0
]);
}
//Menyimpan data Pelanggan disaat melakukan Pendaftaran
public
function
registerStore
(
Request
$data
){
$user
=
new
User
();
$user
->
name
=
$data
[
'name'
];
$user
->
username
=
$data
[
'username'
];
$user
->
email
=
$data
[
'email'
];
$user
->
password
=
bcrypt
(
$data
[
'password'
]);
$user
->
role
=
"Customer"
;
$user
->
foto
=
"gravatar.png"
;
$user
->
save
();
$dataPel
=
DB
::
table
(
'users'
)
->
select
(
'users.id'
)
->
where
(
'users.username'
,
'='
,
$data
[
'username'
])
->
get
();
$cus
=
new
Customer
();
$cus
->
id_akun
=
$dataPel
[
0
]
->
id
;
$cus
->
nama
=
$data
[
'name'
]
;
$cus
->
alamat
=
"---"
;
$cus
->
no_telepon
=
"---"
;
$cus
->
pekerjaan
=
"---"
;
$cus
->
save
();
return
redirect
(
'login'
);
}
//Mengakses Halaman untuk mengedit/mengubah profile
public
function
editProfile
(
$id
){
$data
=
Customer
::
find
(
$id
);
...
...
@@ -206,6 +178,19 @@ class CustomerController extends Controller
$lb
=
new
ListBook
();
$dataPelanggan
=
DB
::
table
(
'users'
)
->
join
(
'pelanggan'
,
'users.id'
,
'='
,
'pelanggan.id_akun'
)
->
select
(
'pelanggan.id'
,
'pelanggan.nama'
)
->
where
(
'users.id'
,
'='
,
Auth
::
user
()
->
id
)
->
get
();
$dataHasilValidPelanggan
=
$this
->
dataValidation
(
$dataPelanggan
[
0
]
->
id
);
if
(
$dataHasilValidPelanggan
>
0
){
//dd($dataHasilValidPelanggan,'nggak boleh');
return
redirect
(
'customerProfile'
)
->
with
(
'message'
,
'Lengkkapi data diri anda!!'
);
}
$dataHomestay
=
DB
::
table
(
'homestay'
)
->
join
(
'kamar'
,
'homestay.id'
,
'='
,
'kamar.id_homestay'
)
->
select
(
'kamar.*'
,
'homestay.harga'
,
'homestay.jumlah_kamar'
)
...
...
@@ -249,12 +234,6 @@ class CustomerController extends Controller
}
}
$dataPelanggan
=
DB
::
table
(
'users'
)
->
join
(
'pelanggan'
,
'users.id'
,
'='
,
'pelanggan.id_akun'
)
->
select
(
'pelanggan.id'
,
'pelanggan.nama'
)
->
where
(
'users.id'
,
'='
,
Auth
::
user
()
->
id
)
->
get
();
$time
=
explode
(
'-'
,
$request
[
'tanggal'
]);
if
(
$time
[
1
]
==
2
){
...
...
@@ -331,5 +310,30 @@ class CustomerController extends Controller
return
redirect
(
'customerHistory'
);
}
public
function
dataValidation
(
$id
){
$dataPelanggan
=
DB
::
table
(
'pelanggan'
)
->
select
(
'pelanggan.*'
)
->
where
(
'pelanggan.id'
,
'='
,
$id
)
->
get
();
$counter
=
0
;
if
(
$dataPelanggan
[
0
]
->
nama
==
"---"
){
$counter
+=
1
;
}
if
(
$dataPelanggan
[
0
]
->
alamat
==
"---"
){
$counter
+=
1
;
}
if
(
$dataPelanggan
[
0
]
->
no_telepon
==
"---"
){
$counter
+=
1
;
}
if
(
$dataPelanggan
[
0
]
->
pekerjaan
==
"---"
){
$counter
+=
1
;
}
return
$counter
;
}
}
app/Http/Controllers/GuestController.php
View file @
7bb4923c
...
...
@@ -34,6 +34,33 @@ class GuestController extends Controller
return
view
(
'welcome'
);
}
//Menyimpan data Pelanggan disaat melakukan Pendaftaran
public
function
registerStore
(
Request
$data
){
$user
=
new
User
();
$user
->
name
=
$data
[
'name'
];
$user
->
username
=
$data
[
'username'
];
$user
->
email
=
$data
[
'email'
];
$user
->
password
=
bcrypt
(
$data
[
'password'
]);
$user
->
role
=
"Customer"
;
$user
->
foto
=
"gravatar.png"
;
$user
->
save
();
$dataPel
=
DB
::
table
(
'users'
)
->
select
(
'users.id'
)
->
where
(
'users.username'
,
'='
,
$data
[
'username'
])
->
get
();
$cus
=
new
Customer
();
$cus
->
id_akun
=
$dataPel
[
0
]
->
id
;
$cus
->
nama
=
$data
[
'name'
]
;
$cus
->
alamat
=
"---"
;
$cus
->
no_telepon
=
"---"
;
$cus
->
pekerjaan
=
"---"
;
$cus
->
save
();
return
redirect
(
'login'
);
}
public
function
register
(){
return
view
(
'adminlte::auth.register'
);
...
...
p2d4ti06_test.sql
deleted
100644 → 0
View file @
8b730aad
This diff is collapsed.
Click to expand it.
resources/views/vendor/adminlte/layouts/customers/profiles.blade.php
View file @
7bb4923c
...
...
@@ -36,6 +36,12 @@
<
a
class
="
agileits
w3layoutswow
slideInLeft
" href="
{{
url
(
'editProfileCustomer/'
.
$data
->
id
)}}
" >Edit Profile <span class="
glyphicon
agileits
w3layouts
glyphicon
-
arrow
-
right
" aria-hidden="
true
"></span></a>
<a class="
agileits
w3layoutswow
slideInLeft
" href="
{{
url
(
'customerHistory'
)}}
">History <span class="
glyphicon
agileits
w3layouts
glyphicon
-
arrow
-
right
" aria-hidden="
true
"></span></a>
</div>
<br><br>
@if(Session::has('message'))
<div class="
alert
alert
-
danger
">
{{ Session::get('message') }}
</div>
@endif
</div>
<div class="
clearfix
"></div>
</div>
...
...
resources/views/vendor/adminlte/layouts/pages/Homestay.blade.php
View file @
7bb4923c
...
...
@@ -15,6 +15,11 @@
<div class="
details
agileits
w3layouts
" style="
margin
-
top
:
10
px
;
padding
:
0
px
">
<br>
@if(Session::has('message'))
<div class="
alert
alert
-
danger
">
{{ Session::get('message') }}
</div>
@endif
<div class="
container
">
@if (count(
$errors
) > 0)
<div class="
alert
alert
-
danger
">
...
...
routes/web.php
View file @
7bb4923c
...
...
@@ -82,12 +82,12 @@ Route::group(['middleware' => 'owner'], function () {
Route
::
get
(
'detailhomestay/{id}'
,
'GuestController@detailhomestay'
);
Route
::
get
(
'daftar'
,
'GuestController@register'
);
Route
::
post
(
'daftar'
,
'GuestController@registerStore'
);
Route
::
group
([
'middleware'
=>
'customer'
],
function
()
{
Route
::
delete
(
'batalkanPemesanan/{id}'
,
'CustomerController@cancelPemesanan'
);
Route
::
put
(
'upload/{id}'
,
'CustomerController@upload'
);
Route
::
get
(
'customerHistory'
,
'CustomerController@history'
);
Route
::
post
(
'daftar'
,
'CustomerController@registerStore'
);
Route
::
post
(
'book'
,
'CustomerController@booking'
);
Route
::
get
(
'buktipembayaran/{id}'
,
'CustomerController@bukti'
);
Route
::
get
(
'editProfileCustomer/{id}'
,
'CustomerController@editProfile'
);
...
...
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