65 lines
1.7 KiB
PHP
65 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Modules\Konfirmasibank\Entities;
|
|
|
|
use Spatie\Activitylog\LogOptions;
|
|
use Spatie\Activitylog\Traits\LogsActivity;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
|
|
class Customer extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
// protected $table = 'customer';
|
|
// protected $primaryKey = 'ID';
|
|
protected $connection = 'db2';
|
|
protected $table = 'STG_DB.CUSTOMER';
|
|
protected $primaryKey = '@ID';
|
|
|
|
//public $incrementing = false;
|
|
|
|
protected $fillable = [
|
|
"'CUSTOMER_NO',
|
|
'MNEMONIC'
|
|
'NAME_1'"
|
|
];
|
|
|
|
public function getAccount(){
|
|
// $store = DB::connection('oracle');
|
|
$data = DB::connection("oracle")->table("T24DWH.V_CUSTOMER")->limit(20)->get()->map(function($item) {return (array) $item;});
|
|
return $data;
|
|
|
|
}
|
|
|
|
public function getCustomer(){
|
|
$data = [];
|
|
$data = DB::connection("oracle")->table("T24DWH.V_CUSTOMER")->select('CUSTOMER_CODE')->limit(50);
|
|
return $data;
|
|
}
|
|
|
|
public function exportPdf($cus_no,$account,$kodecabang,$periode){
|
|
$data = [];
|
|
$data = DB::table('view_customers')
|
|
->where('CUSTOMER_NO',$cus_no)
|
|
->whereIn('ACCOUNT_NUMBER', $account)
|
|
->where('SECTOR',$kodecabang)
|
|
->where('LEGAL_ISS_DATE','LIKE','%'.$periode.'%')
|
|
->get();
|
|
|
|
|
|
return $data;
|
|
}
|
|
|
|
|
|
public function accounts(): HasMany
|
|
{
|
|
return $this->hasMany(Account::class, 'CUSTOMER_CODE');
|
|
}
|
|
|
|
|
|
} |