fix conflict, fix marhun harga, add faker in gadai and fix composer

This commit is contained in:
Hafifie PKB
2023-11-23 16:24:38 +08:00
parent 4333369daa
commit 26730ced83
7 changed files with 171 additions and 11 deletions
+12 -2
View File
@@ -63,7 +63,17 @@ class MarhunController extends Controller
$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();
$marhun = Marhun::on($cawangan['mysql'])->create([
@@ -75,7 +85,7 @@ class MarhunController extends Controller
'nota' => $request->nota,
'karat' => $request->karat,
'berat' => $request->berat_emas,
'harga' => $harga['harga'],
'harga' => $hargaemas,
'n_marhun' => $nilai_marhun
]);
+1 -8
View File
@@ -1,11 +1,7 @@
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": [
"framework",
"laravel",
"lumen"
],
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
@@ -21,9 +17,6 @@
"phpunit/phpunit": "^8.5"
},
"autoload": {
"files": [
"app/helpers.php"
],
"classmap": [
"database/seeds",
"database/factories"
+1 -1
View File
@@ -2,7 +2,7 @@
return [
'default' => 'mysql',
'default' => 'mysql7',
'migrations' => 'migrations',
'connections' => [
'lelong' => [
+81
View File
@@ -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'
];
}
}
+32
View File
@@ -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
];
}
}
+26
View File
@@ -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());
}
}
}
+18
View File
@@ -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();
?>