Commit 3e0d0d9d by Muhammad Iskandar Java

Merge branch 'master' of http://git.unesa.ac.id/aisah/konaspi2024

parents 457bdc73 087b1a4e
......@@ -139,7 +139,7 @@ public function store_kegiatan(Request $request) {
try{
$data = [
'nama' => $request->nama,
'nama' => strip_tags($request->nama),
'harga' => $request->harga
];
Kegiatan::query()->create($data);
......@@ -217,7 +217,8 @@ public function index_konferensi() {
public function store_konferensi(Request $request) {
$rules = [
'nama' => 'required|string'
'nama' => 'required|string',
'harga' => 'required|numeric'
];
$request->validate($rules, ValidationRule::getErrorMessage($rules));
......@@ -226,7 +227,8 @@ public function store_konferensi(Request $request) {
try{
$data = [
'nama' => strip_tags($request->nama)
'nama' => strip_tags($request->nama),
'harga' => $request->harga
];
Konferensi::query()->create($data);
DB::commit();
......@@ -245,7 +247,8 @@ public function store_konferensi(Request $request) {
public function update_konferensi($id, Request $request) {
$rules = [
'nama' => 'required|string'
'nama' => 'required|string',
'harga' => 'required|numeric'
];
$request->validate($rules, ValidationRule::getErrorMessage($rules));
......@@ -254,7 +257,8 @@ public function update_konferensi($id, Request $request) {
try{
$data = [
'nama' => $request->nama
'nama' => $request->nama,
'harga' => $request->harga
];
Konferensi::query()->where('id', $id)->update($data);
......
......@@ -17,7 +17,8 @@ class Konferensi extends Model
protected $fillable = [
'id',
'nama'
'nama',
'harga'
];
public function rKonferensi() {
......
......@@ -26,6 +26,7 @@
<tr style="text-align: center;">
<th>No.</th>
<th>Konferensi</th>
<th>Harga</th>
<th>Aksi</th>
</tr>
</thead>
......@@ -37,6 +38,7 @@
<tr style="text-align: center;">
<td>{{ $no }}</td>
<td>{{ $tr->nama}}</td>
<td>{{ $tr->harga }}</td>
<td>
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#update-modal{{$tr->id}}">Ubah</button>
<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#delete-modal{{$tr->id}}">Hapus</button>
......@@ -51,14 +53,21 @@
<form method="POST" action="{{ route('admin.create_konferensi', ['id' => $tr->id ]) }}" enctype="multipart/form-data">
@csrf
<div class="modal-body" @if ($errors->has('nama')) has-error @endif>
<div class="modal-body">
<div class="form-group" style="text-align: left">
<label for="nama">Nama Konferensi</label>
<input type="text" class="form-control" id="nama" name="nama" required>
<input type="text" class="form-control" id="nama" name="nama" required @if($errors->has('nama')) has-error @endif>
@if ($errors->has('nama'))
<label id="login-error" class="error" for="nama" style="color: red">{{$errors->first('nama')}}</label>
@endif
</div>
<div class="form-group" style="text-align: left">
<label for="harga">Harga</label>
<input type="number" class="form-control" id="harga" name="harga" required @if($errors->has('harga')) has-error @endif>
@if($errors->has('harga'))
<label id="login-error" class="error" for="harga" style="color: red">{{$errors->first('harga')}}</label>
@endif
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary ml-1">Simpan</button>
......@@ -81,14 +90,21 @@
<form method="POST" action="{{ route('admin.update_konferensi', ['id' => $tr->id ]) }}" enctype="multipart/form-data">
@csrf
@method('put')
<div class="modal-body" @if ($errors->has('nama')) has-error @endif>
<div class="modal-body">
<div class="form-group" style="text-align: left">
<label for="nama">Nama Konferensi</label>
<input type="text" class="form-control" id="nama" name="nama" value="{{ $tr->nama }}" required>
<input type="text" class="form-control" id="nama" name="nama" value="{{ $tr->nama }}" required @if($errors->has('nama')) has-error @endif>
@if ($errors->has('nama'))
<label id="login-error" class="error" for="nama" style="color: red">{{$errors->first('nama')}}</label>
@endif
</div>
<div class="form-group" style="text-align: left">
<label for="harga">Harga</label>
<input type="text" class="form-control" id="harga" name="harga" value="{{ $tr->harga }}" required @if($errors->has('harga')) has-error @endif>
@if($errors->has('harga'))
<label id="login-error" class="error" for="harga" style="color: red">{{$errors->first('harga')}}</label>
@endif
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary ml-1">Simpan</button>
......
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