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
d23344dd
Commit
d23344dd
authored
May 08, 2017
by
Juliper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generate homestay dan kamar
parent
077da9b7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
6 deletions
+61
-6
Homestay.php
app/Homestay.php
+15
-0
AdminController.php
app/Http/Controllers/AdminController.php
+42
-2
listPengajuan.blade.php
...ews/vendor/adminlte/layouts/admin/listPengajuan.blade.php
+2
-2
web.php
routes/web.php
+2
-2
No files found.
app/Homestay.php
0 → 100644
View file @
d23344dd
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
Homestay
extends
Model
{
protected
$table
=
"homestay"
;
protected
$fillable
=
[
'idPemilik'
,
'nama'
,
'owner'
,
'alamat'
,
'jumlahKamar'
,
'harga'
,
'status'
,
];
}
app/Http/Controllers/AdminController.php
View file @
d23344dd
...
...
@@ -2,7 +2,9 @@
namespace
App\Http\Controllers
;
use
App\Homestay
;
use
App\RequestHomestay
;
use
App\Room
;
use
Illuminate\Http\Request
;
use
App\User
;
use
Validator
;
...
...
@@ -124,9 +126,47 @@ class AdminController extends Controller
}
public
function
AccPengajuanHomestay
(
$id
){
$RH
=
RequestHomestay
::
where
(
'idPengajuan'
,
$id
)
->
first
()
->
get
();
dd
(
"masuk gan"
,
$id
,
$RH
);
//dd("masuk gan");
$RH
=
RequestHomestay
::
find
(
$id
);
$RH
->
status
=
1
;
$data
=
DB
::
table
(
'pengajuan_homestay'
)
->
join
(
'pemilikhomestay'
,
'pemilikhomestay.id'
,
'='
,
'pengajuan_homestay.idPemilikHomestay'
)
->
select
(
'pemilikhomestay.nama'
,
'pemilikhomestay.alamat'
)
->
where
(
'pemilikhomestay.id'
,
'='
,
$RH
->
idPemilikHomestay
)
->
get
();
//dd($data[0]->nama,$data[0]->alamat);
$hs
=
new
Homestay
();
$hs
->
idPemilik
=
$RH
->
idPemilikHomestay
;
$hs
->
nama
=
$RH
->
namaHomestay
;
$hs
->
owner
=
$data
[
0
]
->
nama
;
$hs
->
alamat
=
$data
[
0
]
->
alamat
;
$hs
->
jumlahKamar
=
$RH
->
jumlahKamar
;
$hs
->
harga
=
150000
;
$hs
->
status
=
'----'
;
$hs
->
save
();
$idHts
=
DB
::
table
(
'homestay'
)
->
select
(
'homestay.*'
)
->
where
(
'homestay.owner'
,
'='
,
$data
[
0
]
->
nama
)
->
get
();
//dd("sampai sini dulu",$idHts);
for
(
$i
=
1
;
$i
<=
$RH
->
jumlahKamar
;
$i
++
){
$km
=
new
Room
();
$km
->
idHomestay
=
$idHts
[
0
]
->
id
;
$km
->
nomor_kamar
=
$i
;
$km
->
jumlah_bed
=
2
;
$km
->
save
();
}
$RH
->
update
();
return
redirect
(
'requestHomestay'
);
}
...
...
resources/views/vendor/adminlte/layouts/admin/listPengajuan.blade.php
View file @
d23344dd
...
...
@@ -54,13 +54,13 @@
<td>Ditolak</td>
@elseif(
$a->status
==0)
<td>
<form action="
{{
url
(
'listPengajuan
Fasilitas/'
.
$a
->
idPengajuan
)}}
" method="
post
">
<form action="
{{
url
(
'listPengajuan
Homestay/'
.
$a
->
id
)}}
" method="
post
">
{
{csrf_field()}
}
<input type="
hidden
" name="
_method
" value="
PUT
">
<button type="
submit
" class="
btn
btn
-
info
"><i class="
glyphicon
glyphicon
-
apple
"> Terima</i></button>
</form>
<td>
<form action="
{{
url
(
'
requestFasilitass/'
.
$a
->
idPengajuan
)}}
" method="
post
">
<form action="
{{
url
(
'
listPengajuanHomestay/'
.
$a
->
id
)}}
" method="
post
">
{
{csrf_field()}
}
<input type="
hidden
" name="
_method
" value="
PUT
">
<button type="
submit
" class="
btn
btn
-
danger
"><i class="
glyphicon
glyphicon
-
trash
"> Tolak</i></button>
...
...
routes/web.php
View file @
d23344dd
...
...
@@ -56,10 +56,10 @@ Route::get('requestFasilitas','AdminController@RequestFasilitas');
Route
::
get
(
'pengajuanHomestay'
,
'OwnerController@pengajuan'
);
Route
::
post
(
'pengajuanHomestay'
,
'OwnerController@storePengajuan'
);
Route
::
get
(
'listPengajuan'
,
'OwnerController@listPengajuan'
);
Route
::
get
(
'listPengajuan
Fasilitas
'
,
'OwnerController@listPengajuanFasilitas'
);
Route
::
get
(
'listPengajuan
Homestay
'
,
'OwnerController@listPengajuanFasilitas'
);
Route
::
put
(
'requestFasilitas/{id}'
,
'AdminController@UpdateRequestFasilitas'
);
Route
::
put
(
'requestFasilitass/{id}'
,
'AdminController@UpdateRequestFasilitass'
);
Route
::
put
(
'listPengajuan
Fasilitas
/{id}'
,
'AdminController@AccPengajuanHomestay'
);
Route
::
put
(
'listPengajuan
Homestay
/{id}'
,
'AdminController@AccPengajuanHomestay'
);
Route
::
resource
(
'profile'
,
'ProfileController'
);
Route
::
get
(
'reqFasilitas'
,
'OwnerController@requestFasilitas'
);
...
...
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