Commit 340aba89 by Triyah Fatmawati

Change connection to DB SIMEPK

parent 2af73e7a
......@@ -6,6 +6,8 @@
use App\Http\Controllers\Controller;
use App\Models\Admin\Penelaah;
use App\Models\Admin\Pengajuan;
use App\Models\VPenelaah;
use App\Models\VPengusul;
use Exception;
use Storage;
use Session;
......@@ -33,7 +35,13 @@ public function index(Request $request) {
$periode = DB::table('ms_periode')->where('periode', Session::get('periode'))->first();
}
$pengusul = DB::table('bantuan_pengusul')
// v0
// $pengusul = DB::table('bantuan_pengusul')
// ->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir])
// ->get();
// v1
$pengusul = VPengusul::with('penelaah')
->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir])
->get();
......@@ -54,8 +62,15 @@ public function index(Request $request) {
$periode = DB::table('ms_periode')->where('periode', Session::get('periode'))->first();
}
$pengusul = DB::table('bantuan_pengusul')
->whereIn('id_pengajuan',$list)
// v0
// $pengusul = DB::table('bantuan_pengusul')
// ->whereIn('id_pengajuan',$list)
// ->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir])
// ->get();
// v1
$pengusul = VPengusul::with('penelaah')
->whereIn('id_pengajuan', $list)
->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir])
->get();
......@@ -67,7 +82,14 @@ public function index(Request $request) {
$periode = DB::table('ms_periode')->where('periode', Session::get('periode'))->first();
}
$pengusul = DB::table('bantuan_pengusul')
// v0
// $pengusul = DB::table('bantuan_pengusul')
// ->whereNotIn('id_pengajuan',$list)
// ->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir])
// ->get();
// v1
$pengusul = VPengusul::with('penelaah')
->whereNotIn('id_pengajuan',$list)
->whereBetween('tanggal_keputusan', [$periode->tanggal_awal, $periode->tanggal_akhir])
->get();
......@@ -123,11 +145,15 @@ public function store(Request $request){
'no_sk' => $request->nosurat,
];
Pengajuan::query()->create($transaksi);
$hasil = Pengajuan::query()->create($transaksi);
// $hasil = DB::table('tr_pengajuan')->where('id_pengajuan',$request->idpengajuan)->first();
$hasil = DB::table('tr_pengajuan')->where('id_pengajuan',$request->idpengajuan)->first();
// v0
// $reviewer = DB::table('bantuan_penelaah')->where('id_pengajuan',$request->idpengajuan)->pluck('nik');
$reviewer = DB::table('bantuan_penelaah')->where('id_pengajuan',$request->idpengajuan)->pluck('nik');
// v1
$reviewer = VPenelaah::where('id_pengajuan', $request->idpengajuan)->pluck('nik');
$count = DB::connection('isdm')->table('v_detil_pegawai')->whereIn('noktp',$reviewer)->select('noktp')->get();
......
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class VPenelaah extends Model
{
protected $connection = 'epk';
protected $table = 'v_penelaah_v0';
protected $primaryKey = 'id_pengajuan';
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class VPengusul extends Model
{
protected $connection = 'epk';
protected $table = 'v_pengusul';
protected $primaryKey = 'id_pengajuan';
public function penelaah()
{
return $this->hasMany(VPenelaah::class, 'id_pengajuan', 'id_pengajuan');
}
}
......@@ -105,23 +105,39 @@
'schema' => 'public',
],
// 'epk' => [
// 'driver' => 'mysql',
// 'host' => env('DB_HOST_EPK', 'localhost'),
// 'port' => env('DB_PORT_EPK', '3306'),
// 'database' => env('DB_DATABASE_EPK', 'forge'),
// 'username' => env('DB_USERNAME_EPK', 'forge'),
// 'password' => env('DB_PASSWORD_EPK', ''),
// 'charset' => 'utf8',
// 'collation' => 'utf8_unicode_ci',
// 'prefix' => '',
// 'strict' => false,
// 'engine' => null,
// 'options' => [
// \PDO::MYSQL_ATTR_LOCAL_INFILE => true,
// ],
// ],
'epk' => [
'driver' => 'mysql',
'host' => env('DB_HOST_EPK', 'localhost'),
'host' => env('DB_HOST_EPK', '127.0.0.1'),
'port' => env('DB_PORT_EPK', '3306'),
'database' => env('DB_DATABASE_EPK', 'forge'),
'username' => env('DB_USERNAME_EPK', 'forge'),
'password' => env('DB_PASSWORD_EPK', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_general_ci',
'prefix' => '',
'strict' => false,
'strict' => true,
'engine' => null,
'options' => [
\PDO::MYSQL_ATTR_LOCAL_INFILE => true,
],
],
'ssh' => [
'host' => env('SSH_HOST'),
'port' => env('SSH_PORT'),
......
......@@ -77,14 +77,18 @@
<tr>
<td>{{ $no }}</td>
<td style="text-align: left">{{ $item->judul }}</td>
<td style="text-align: left">{{ $item->peneliti_utama }}</td>
{{-- <td style="text-align: left">{{ $item->peneliti_utama }}</td> --}}
<td style="text-align: left">{{ $item->ketua }}</td>
<td style="text-align: left">{{ date('Y',strtotime($item->tanggal_keputusan)) }}</td>
@php
{{-- @php
$penelaah = DB::table('bantuan_penelaah')->where('id_pengajuan', $item->id_pengajuan)->get();
@endphp
@endphp --}}
<td style="text-align: left">
@foreach($penelaah as $p)
{{-- @foreach($penelaah as $p)
{{ $p->penelaah.";" }}<br><br>
@endforeach --}}
@foreach ($item->penelaah as $rev)
{{ $rev->penelaah.";" }}<br><br>
@endforeach
</td>
<td style="text-align: left">{{ $item->klasifikasi }}</td>
......@@ -122,7 +126,9 @@
</div>
<div class="col-md-12">
<label class="form-label" for="peneliti">Peneliti</label>
<input type="text" class="form-control" id="peneliti" name="peneliti" value="{{ $item->peneliti_utama }}" readonly />
{{-- <input type="text" class="form-control" id="peneliti" name="peneliti" value="{{ $item->peneliti_utama }}" readonly /> --}}
<input type="text" class="form-control" id="peneliti" name="peneliti" value="{{ $item->ketua }}" readonly />
</div>
<div class="col-md-6">
<label class="form-label" for="tahun">Tahun</label>
......
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