Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pa21617d4ti08
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
jhon
pa21617d4ti08
Commits
4af52e65
Commit
4af52e65
authored
May 08, 2017
by
jhon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Crud Barang
parent
5ae9f5d2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
346 additions
and
20 deletions
+346
-20
Barang.php
app/Barang.php
+12
-0
InventoriController.php
app/Http/Controllers/InventoriController.php
+77
-1
create.blade.php
...ews/vendor/adminlte/inventori/ListBarang/create.blade.php
+109
-0
edit.blade.php
...views/vendor/adminlte/inventori/ListBarang/edit.blade.php
+111
-0
index.blade.php
...iews/vendor/adminlte/inventori/ListBarang/index.blade.php
+31
-10
web.php
routes/web.php
+6
-9
No files found.
app/Barang.php
0 → 100644
View file @
4af52e65
<?php
namespace
App
;
use
Illuminate\Database\Eloquent\Model
;
class
Barang
extends
Model
{
protected
$fillable
=
[
'nama'
,
'jumlah'
,
'harga'
,
'deskripsi'
,
'kategori'
,
'gambar'
,
];
}
app/Http/Controllers/InventoriController.php
View file @
4af52e65
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
App\Http\Requests
;
use
App\Barang
;
class
InventoriController
extends
Controller
{
public
function
ListBarang
()
{
return
view
(
'adminlte::inventori.ListBarang.index'
);
$barangs
=
Barang
::
all
();
return
view
(
'adminlte::inventori.ListBarang.index'
,
compact
(
'barangs'
));
}
public
function
create
()
{
return
view
(
'adminlte::inventori.ListBarang.create'
);
}
public
function
store
(
Request
$request
)
{
$this
->
validate
(
$request
,
[
'nama'
=>
'required'
,
'jumlah'
=>
'required'
,
'harga'
=>
'required'
,
'deskripsi'
=>
'required'
,
'kategori'
=>
'required'
,
'gambar'
=>
'required'
,
]);
$barangs
=
new
Barang
();
$barangs
->
nama
=
$request
[
'nama'
];
$barangs
->
jumlah
=
$request
[
'jumlah'
];
$barangs
->
harga
=
$request
[
'harga'
];
$barangs
->
deskripsi
=
$request
[
'deskripsi'
];
$barangs
->
kategori
=
$request
[
'kategori'
];
$barangs
->
gambar
=
$request
[
'gambar'
];
$barangs
->
save
();
return
redirect
(
'ListBarang'
);
}
public
function
edit
(
$id
)
{
$barangs
=
Barang
::
where
(
'id'
,
$id
)
->
first
();
return
view
(
'adminlte::inventori.ListBarang.edit'
)
->
with
(
'barangs'
,
$barangs
);
}
public
function
update
(
Request
$request
,
$id
)
{
$this
->
validate
(
$request
,
[
'nama'
=>
'required'
,
'jumlah'
=>
'required'
,
'harga'
=>
'required'
,
'deskripsi'
=>
'required'
,
'kategori'
=>
'required'
,
'gambar'
=>
'required'
,
]);
$barangs
=
Barang
::
findOrFail
(
$id
);
$barangs
->
nama
=
$request
->
nama
;
$barangs
->
jumlah
=
$request
->
jumlah
;
$barangs
->
harga
=
$request
->
harga
;
$barangs
->
deskripsi
=
$request
->
deskripsi
;
$barangs
->
kategori
=
$request
->
kategori
;
$barangs
->
gambar
=
$request
->
gambar
;
$barangs
->
save
();
return
redirect
(
'ListBarang'
);
}
public
function
destroy
(
$id
)
{
$barangs
=
Barang
::
find
(
$id
);
$barangs
->
delete
();
return
redirect
(
'ListBarang'
);
}
public
function
ListRequest
()
{
return
view
(
'adminlte::inventori.ListRequest.index'
);
...
...
resources/views/vendor/adminlte/inventori/ListBarang/create.blade.php
0 → 100644
View file @
4af52e65
@
extends
(
'adminlte::layouts.app'
)
@
section
(
'htmlheader_title'
)
Create
@
endsection
@
section
(
'contentheader_title'
)
Page
Create
List
Barang
@
endsection
@
section
(
'main-content'
)
<
div
class
="
container
">
<div class="
col
-
md
-
8
col
-
md
-
offset
-
2
">
<div class="
panel
-
body
">
<form class="
form
-
horizontal
" action="
{{
url
(
'store'
)
}}
" method="
POST
">
{!! csrf_field() !!}
<div class="
form
-
group
{{
$errors
->
has
(
'nama'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Nama</label>
<div class="
col
-
md
-
6
">
<input type="
text
" class="
form
-
control
" name="
nama
" value="
{{
old
(
'nama'
)
}}
" >
@if (
$errors->has
('nama'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('nama') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'jumlah'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Jumlah</label>
<div class="
col
-
md
-
6
">
<input type="
text
" class="
form
-
control
" name="
jumlah
" value="
{{
old
(
'jumlah'
)
}}
" >
@if (
$errors->has
('jumlah'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('jumlah') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'harga'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Harga</label>
<div class="
col
-
md
-
6
">
<input type="
text
" class="
form
-
control
" name="
harga
" value="
{{
old
(
'harga'
)
}}
" >
@if (
$errors->has
('harga'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('harga') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'deskripsi'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Deskripsi</label>
<div class="
col
-
md
-
6
">
<input type="
text
" class="
form
-
control
" name="
deskripsi
" value="
{{
old
(
'deskripsi'
)
}}
" >
@if (
$errors->has
('deskripsi'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('deskripsi') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'kategori'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Kategori</label>
<div class="
col
-
md
-
6
">
<select name="
kategori
" class="
form
-
control
">
<option value="
makanan
">Makanan</option>
<option value="
minuman
">Minuman</option>
<option value="
alat
tulis
">Alat Tulis</option>
<option value="
alat
mandi
">Alat Mandi</option>
</select>
@if (
$errors->has
('kategori'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('kategori') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'gambar'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Gambar</label>
<div class="
col
-
md
-
6
">
<input type="
text
" class="
form
-
control
" name="
gambar
" value="
{{
old
(
'gambar'
)
}}
" >
@if (
$errors->has
('gambar'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('gambar') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
">
<div class="
col
-
md
-
6
col
-
md
-
offset
-
4
">
<input type="
hidden
" name="
_token
" value="
{{
csrf_token
()
}}
">
<button type="
submit
" class="
btn
btn
-
primary
">
Tambah
</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
\ No newline at end of file
resources/views/vendor/adminlte/inventori/ListBarang/edit.blade.php
0 → 100644
View file @
4af52e65
@
extends
(
'adminlte::layouts.app'
)
@
section
(
'htmlheader_title'
)
Edit
@
endsection
@
section
(
'contentheader_title'
)
Page
Edit
Request
@
endsection
@
section
(
'main-content'
)
<
div
class
="
container
">
<div class="
col
-
md
-
8
col
-
md
-
offset
-
2
">
<div class="
panel
-
body
">
<form class="
form
-
horizontal
" action="
{{
url
(
'update'
,
$barangs
->
id
)
}}
" method="
POST
">
{!! csrf_field() !!}
<div class="
form
-
group
{{
$errors
->
has
(
'nama'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Nama</label>
<div class="
col
-
md
-
6
">
<input type="
text
" class="
form
-
control
" name="
nama
" value="
{{
$barangs
->
nama
}}
" >
@if (
$errors->has
('nama'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('nama') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'jumlah'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Jumlah</label>
<div class="
col
-
md
-
6
">
<input type="
text
" class="
form
-
control
" name="
jumlah
" value="
{{
$barangs
->
jumlah
}}
" >
@if (
$errors->has
('jumlah'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('jumlah') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'harga'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Harga</label>
<div class="
col
-
md
-
6
">
<input type="
text
" class="
form
-
control
" name="
harga
" value="
{{
$barangs
->
harga
}}
" >
@if (
$errors->has
('harga'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('harga') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'deskripsi'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Deskripsi</label>
<div class="
col
-
md
-
6
">
<input type="
text
" class="
form
-
control
" name="
deskripsi
" value="
{{
$barangs
->
deskripsi
}}
" >
@if (
$errors->has
('deskripsi'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('deskripsi') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'kategori'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
" value="
{{
$barangs
->
gambar
}}
">Kategori</label>
<div class="
col
-
md
-
6
">
<select name="
kategori
" class="
form
-
control
">
<option value="
makanan
">Makanan</option>
<option value="
minuman
">Minuman</option>
<option value="
alat
tulis
">Alat Tulis</option>
<option value="
alat
mandi
">Alat Mandi</option>
</select>
@if (
$errors->has
('kategori'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('kategori') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
{{
$errors
->
has
(
'gambar'
)
?
' has-error'
:
''
}}
">
<label for="
title
" class="
col
-
md
-
4
control
-
label
">Gambar</label>
<div class="
col
-
md
-
6
">
<input type="
text
" class="
form
-
control
" name="
gambar
" value="
{{
$barangs
->
gambar
}}
" >
@if (
$errors->has
('gambar'))
<span class="
help
-
block
">
<strong>{{
$errors->first
('gambar') }}</strong>
</span>
@endif
</div>
</div>
<div class="
form
-
group
">
<div class="
col
-
md
-
6
col
-
md
-
offset
-
4
">
<button type="
submit
" class="
btn
btn
-
primary
">
Simpan
</button>
</div>
</div>
</form>
</div>
</div>
</div>
@endsection
\ No newline at end of file
resources/views/vendor/adminlte/inventori/ListBarang/index.blade.php
View file @
4af52e65
...
...
@@ -9,14 +9,35 @@
@
endsection
@
section
(
'main-content'
)
<
div
class
="
container
-
fluid
spark
-
screen
">
<div class="
row
">
<div class="
col
-
md
-
8
col
-
md
-
offset
-
2
">
<div class="
panel
panel
-
default
">
</div>
</div>
</div>
</div>
<
table
class
="
table
table
-
striped
">
<thead>
<tr>
<th>Nama Barang</th>
<th>Stock</th>
<th>Harga</th>
<th>Deskripsi</th>
<th>Kategori</th>
<th>Gambar</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach(
$barangs
as
$barang
)
<tr>
<td>
{
{$barang->nama}
}
</td>
<td>
{
{$barang->jumlah}
}
</td>
<td>
{
{$barang->harga}
}
</td>
<td>
{
{$barang->deskripsi}
}
</td>
<td>
{
{$barang->kategori}
}
</td>
<td>
{
{$barang->gambar}
}
</td>
<td>
<a href="
{{
url
(
'/edit'
,
$barang
->
id
)
}}
" type="
submit
" button type="
button
" class="
btn
btn
-
warning
">Edit</a>
<a href="
{{
url
(
'/delete'
,
$barang
->
id
)
}}
" class="
btn
btn
-
warning
">Delete</a>
<!-- <a href="
{{
url
(
'/delete'
,
$barang
->
id
)
}}
" <onclick="
return
confirm
(
'Yakin mau hapus data ini sob?'
)
" class="
btn
btn
-
warning
">Delete</a> -->
</tr>
@endforeach
</tbody>
</table>
<a href="
{{
url
(
'/create'
)
}}
" button type="
button
" class="
btn
btn
-
info
">Create</a></button>
@endsection
routes/web.php
View file @
4af52e65
...
...
@@ -58,15 +58,12 @@ Route::group(['middleware' => ['web','auth','customer']], function () {
});
Route
::
group
([
'middleware'
=>
[
'web'
,
'auth'
,
'inventori'
]],
function
()
{
Route
::
get
(
'/ListBarang'
,
'InventoriController@ListBarang'
);
Route
::
get
(
'/ListRequest'
,
'InventoriController@ListRequest'
);
// Route::get('/pegawai', 'OrderController@index');
// Route::get('/create', 'OrderController@create');
// Route::post('/store', 'OrderController@store');
// Route::get('/edit/{id}', 'OrderController@edit');
// Route::post('/update/{id}', 'OrderController@update');
// Route::get('/delete/{id}', 'OrderController@destroy');
// Route::get('/allTransaksi', 'TransaksiController@allTransaksi');
Route
::
get
(
'/ListBarang'
,
'InventoriController@listBarang'
);
Route
::
get
(
'/create'
,
'InventoriController@create'
);
Route
::
post
(
'/store'
,
'InventoriController@store'
);
Route
::
get
(
'/edit/{id}'
,
'InventoriController@edit'
);
Route
::
post
(
'/update/{id}'
,
'InventoriController@update'
);
Route
::
get
(
'/delete/{id}'
,
'InventoriController@destroy'
);
});
Route
::
group
([
'middleware'
=>
[
'web'
,
'auth'
,
'kasir'
]],
function
()
{
...
...
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