fix conflict, fix marhun harga, add faker in gadai and fix composer
This commit is contained in:
@@ -63,7 +63,17 @@ class MarhunController extends Controller
|
|||||||
|
|
||||||
$harga = HargaEmas::on('mysql7')->where('karat',$request->karat)->first();
|
$harga = HargaEmas::on('mysql7')->where('karat',$request->karat)->first();
|
||||||
|
|
||||||
$nilai_marhun = $request->berat_emas * $harga['harga'];
|
$hargaemas = $harga['harga'];
|
||||||
|
if(isset($request->jenisAT)){
|
||||||
|
if($request->jenisAT == 'hargalama'){
|
||||||
|
$hargaemas = $request->harga;
|
||||||
|
// $nilai_marhun = $request->berat_emas * $request->harga;
|
||||||
|
}else $hargaemas = $harga['harga'];
|
||||||
|
// $nilai_marhun = $request->berat_emas * $harga['harga'];
|
||||||
|
}else $hargaemas = $harga['harga'];
|
||||||
|
|
||||||
|
$nilai_marhun = $request->berat_emas * $hargaemas;
|
||||||
|
|
||||||
|
|
||||||
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
|
||||||
$marhun = Marhun::on($cawangan['mysql'])->create([
|
$marhun = Marhun::on($cawangan['mysql'])->create([
|
||||||
@@ -75,7 +85,7 @@ class MarhunController extends Controller
|
|||||||
'nota' => $request->nota,
|
'nota' => $request->nota,
|
||||||
'karat' => $request->karat,
|
'karat' => $request->karat,
|
||||||
'berat' => $request->berat_emas,
|
'berat' => $request->berat_emas,
|
||||||
'harga' => $harga['harga'],
|
'harga' => $hargaemas,
|
||||||
'n_marhun' => $nilai_marhun
|
'n_marhun' => $nilai_marhun
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
+1
-5
@@ -1,11 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "laravel/lumen",
|
"name": "laravel/lumen",
|
||||||
"description": "The Laravel Lumen Framework.",
|
"description": "The Laravel Lumen Framework.",
|
||||||
"keywords": [
|
"keywords": ["framework", "laravel", "lumen"],
|
||||||
"framework",
|
|
||||||
"laravel",
|
|
||||||
"lumen"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"require": {
|
"require": {
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
|
||||||
|
class GadaiFactory
|
||||||
|
{
|
||||||
|
protected $faker;
|
||||||
|
|
||||||
|
public function __construct(Faker $faker)
|
||||||
|
{
|
||||||
|
$this->faker = $faker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
static $number = 1;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'kodcaw' => 'KB2',
|
||||||
|
'norujukan' => ($number > 9) ? 'KB2231123-00' . $number : 'KB2231123-000' . $number ,
|
||||||
|
'nopelanggan' => 'M03-00009968',
|
||||||
|
'nokp' => '630411035213',
|
||||||
|
't_gadai' => '2023-11-23',
|
||||||
|
'masa' => '13:46:57',
|
||||||
|
'sirig' => $number++,
|
||||||
|
'nilaimarhun' => 3000.09,
|
||||||
|
'berat' => 10.17,
|
||||||
|
'pinjaman' => 2300,
|
||||||
|
'telahbayar' => 0.00,
|
||||||
|
'upahtelahbyr' => 0.00,
|
||||||
|
'cajtelahbyr' => null,
|
||||||
|
'ansuran' => null,
|
||||||
|
'ansupah' => null,
|
||||||
|
'kadarupah' => null,
|
||||||
|
'tempoh' => 0.5,
|
||||||
|
't_lelong' => null,
|
||||||
|
't_hapus' => null,
|
||||||
|
'sttebus' => '',
|
||||||
|
'terima' => 1,
|
||||||
|
'cetak' => 1,
|
||||||
|
'tncek' => null,
|
||||||
|
'nocek' => null,
|
||||||
|
'bkcode' => null,
|
||||||
|
'teller' => 'NORLY BINTI DERAMAN',
|
||||||
|
'pelulus' => null,
|
||||||
|
'cancelid' => null,
|
||||||
|
'canceltime' => null,
|
||||||
|
'f_lulus' => null,
|
||||||
|
'tag' => null,
|
||||||
|
'jbg' => 0.5,
|
||||||
|
'bakipjm' => 2300,
|
||||||
|
'bakiupah' => 39.1,
|
||||||
|
'upahdibayar' => 0.00,
|
||||||
|
'marhun' => '1 R/L,',
|
||||||
|
'taglel' => null,
|
||||||
|
't_update' => '2023-11-23',
|
||||||
|
't_matang' => '2024-06-24',
|
||||||
|
't_matang1' => '2024-06-24',
|
||||||
|
'penilai' => 'MOHD KHALID ABDUL RAHMAN',
|
||||||
|
'tagserah' => 1,
|
||||||
|
'namapelulus' => '',
|
||||||
|
'percentpinj' => 80,
|
||||||
|
'namateller' => 'NORLY BINTI DERAMAN',
|
||||||
|
'jumtebus' => 0.00,
|
||||||
|
'upahnotis' => 0.00,
|
||||||
|
'tagpalsu' => 0,
|
||||||
|
'historygadaian' => '',
|
||||||
|
'tagcetak' => 1,
|
||||||
|
'lel1stop' => 0,
|
||||||
|
'tebus' => null,
|
||||||
|
'bakihargajualan' => 2769.2,
|
||||||
|
'hargajualan' => 2769.2,
|
||||||
|
'upah12' => 120,
|
||||||
|
'tagkomuditi' => 0,
|
||||||
|
'tempohbayar' => 0,
|
||||||
|
'lelong_tawarruq' => 0,
|
||||||
|
'semakbarcode' => 'Lulus'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
|
||||||
|
class MarhunFactory
|
||||||
|
{
|
||||||
|
protected $faker;
|
||||||
|
|
||||||
|
public function __construct(Faker $faker)
|
||||||
|
{
|
||||||
|
$this->faker = $faker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
static $number = 1;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'kodcaw' => 'KB2',
|
||||||
|
'marhun' => 'R/L',
|
||||||
|
't_gadai' => '2023-11-23',
|
||||||
|
'norujukan' => ($number > 9) ? 'KB2231123-00' . $number : 'KB2231123-000' . $number ,
|
||||||
|
'bil' => 1,
|
||||||
|
'nota' => $number++,
|
||||||
|
'karat' => '24.0K',
|
||||||
|
'berat' => 10.17,
|
||||||
|
'harga' => 295.11,
|
||||||
|
'n_marhun' => 3000.09
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Faker\Factory as FakerFactory;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class GadaiSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
$faker = FakerFactory::create();
|
||||||
|
$gadaiFactory = new GadaiFactory($faker);
|
||||||
|
|
||||||
|
// Create 10 instances of Gadai
|
||||||
|
for ($i = 0; $i < 10; $i++) {
|
||||||
|
DB::connection('mysql')->table('gadai')->insert($gadaiFactory->create());
|
||||||
|
DB::connection('mysql')->table('marhun')->insert($gadaiFactory->create());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
use Faker\Factory as FakerFactory;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
$faker = FakerFactory::create();
|
||||||
|
$gadaiFactory = new GadaiFactory($faker);
|
||||||
|
$marhunFactory = new MarhunFactory($faker);
|
||||||
|
|
||||||
|
|
||||||
|
// Create 10 instances of Gadai
|
||||||
|
for ($i = 0; $i < 10; $i++) {
|
||||||
|
DB::connection('mysql')->table('gadai')->insert($gadaiFactory->create());
|
||||||
|
DB::connection('mysql')->table('marhun')->insert($marhunFactory->create());
|
||||||
|
}
|
||||||
|
|
||||||
|
exit();
|
||||||
|
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user