Commit 685c324f by Siti Aisah

update kategori pengusul

parent d3988bcd
......@@ -3,30 +3,75 @@
namespace App\Http\Controllers;
use App\Http\Support\ValidationRule;
use Illuminate\Support\Facades\Hash;
use App\Http\Controllers\Controller;
use App\Models\Kegiatan;
use App\Models\KegiatanPeserta;
use App\Models\Konferensi;
use App\Models\Registrasi;
use App\Models\User;
use App\Models\VRegistrasi;
use App\Models\Admin\Pengajuan;
use Exception;
use Storage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redirect;
class TransaksiController extends Controller
{
public function index() {
$tr = DB::connection('epk')->table('v_penelaah')->get();
$pengusul = DB::table('bantuan_pengusul')->get();
$kategori = DB::table('ms_kategori')->orderBy('kode_kategori','asc')->get();
dd($tr);
$data = [
'semua' => $tr,
'pengusul' => $pengusul,
'kategori' => $kategori
];
return view('transaksi.index', $data);
}
public function store(Request $request){
$rule = [
'kategori' => 'required',
'file_ec' => 'required',
'nosurat' => 'required'
];
$request->validate($rule, ValidationRule::getErrorMessage($rule));
DB::beginTransaction();
if($request->hasFile('file_ec')){
$file = $request->file('file_ec');
$filename = $file->getClientOriginalName();
Storage::disk('uploads')->put('sipeka/'.$filename, file_get_contents($file->getRealPath()));
}
try{
$transaksi = [
'id_pengajuan' => $request->idpengajuan,
'judul' => $request->judul,
'pengusul' => $request->pengusul,
'klasifikasi' => $request->klasifikasi,
'tahun' => $request->tahun,
'id_kategori' => $request->kategori,
'file_ec' => $filename,
'no_sk' => $request->nosurat,
];
Pengajuan::query()->create($transaksi);
DB::commit();
return Redirect::route('transaksi.index')
->with('success', 'Data kategori berhasil diupdate');
}
catch(Exception $e){
Log::error($e);
DB::rollBack();
return Redirect::route('transaksi.index')
->with('error', 'Data kategori gagal diupdate');
}
}
}
<?php
namespace App\Models\Admin;
use App\Traits\Uuid;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Penelaah extends Model
{
use HasFactory;
use Uuid;
public $incrementing = false;
protected $table = 'tr_penelaah';
protected $keyType = 'string';
protected $guarded = [];
}
<?php
namespace App\Models\Admin;
use App\Traits\Uuid;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Pengajuan extends Model
{
use HasFactory;
use Uuid;
public $incrementing = false;
protected $table = 'tr_pengajuan';
protected $keyType = 'string';
protected $fillable = [
'id',
'id_pengajuan',
'judul',
'pengusul',
'klasifikasi',
'tahun',
'id_kategori',
'file_ec',
'no_sk'
];
}
......@@ -117,8 +117,19 @@
'prefix' => '',
'strict' => false,
'engine' => null,
'options' => [
\PDO::MYSQL_ATTR_LOCAL_INFILE => true,
],
],
'ssh' => [
'host' => env('SSH_HOST'),
'port' => env('SSH_PORT'),
'username' => env('SSH_USER'),
'key' => env('SSH_KEY'),
],
],
/*
......
......@@ -56,6 +56,14 @@
'throw' => false,
],
'uploads' => [
'driver' => 'ftp',
'host' => 'statik.unesa.ac.id',
'username' => 'anchuz',
'password' => 'k0nt3nstatik@un3s4ppt1!)@(#*',
'ssl' => true,
],
],
/*
......
......@@ -11,7 +11,7 @@
</li>
<li class="dropdown nav-item" data-menu="dropdown"><a class="dropdown-toggle nav-link d-flex align-items-center" href="#" data-bs-toggle="dropdown"><i data-feather='edit'></i><span data-i18n="Apps">Transaksi</span></a>
<ul class="dropdown-menu" data-bs-popper="none">
<li data-menu="" class="{{ (request()->is('/transaksi')) ? 'active' : '' }}"><a href="{{ route('admin.index-transaksi') }}" class="dropdown-item d-flex align-items-center" data-bs-toggle="" data-i18n="Email" ><i data-feather="check-square"></i><span data-i18n="Email">Update Kategori</span></a>
<li data-menu="" class="{{ (request()->getRequestUri() == "/transaksi") ? 'active' : '' }}"><a href="{{ route('transaksi.index') }}" class="dropdown-item d-flex align-items-center" data-bs-toggle="" data-i18n="Email" ><i data-feather="check-square"></i><span data-i18n="Email">Update Kategori</span></a>
</li>
<li data-menu="" class="{{ (request()->is('pasien/antrian')) ? 'active' : '' }}"><a href="#" class="dropdown-item d-flex align-items-center" data-bs-toggle="" data-i18n="Todo" ><i data-feather='log-in'></i><span data-i18n="Todo">Tarik Data SAKU</span></a>
</li>
......
......@@ -19,9 +19,10 @@
return view('dashboard');
});
Route::get('/transaksi', [TransaksiController::class, 'index'])->name('admin.index-transaksi');
// Route::get('/home', [TransaksiController::class, 'index'])->name('admin.index-transaksi');
// Admin
Route::resource('kategori', KategoriController::class);
Route::resource('transaksi', TransaksiController::class);
// End of Admin
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