Merge branch 'ujrah_master' of https://bitbucket.org/arrahn-pkb/api_arrahn into api-laporan-ujrah

This commit is contained in:
Amirah
2023-11-27 09:40:59 +08:00
16 changed files with 8028 additions and 4 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
]);
@@ -0,0 +1,58 @@
<?php
namespace App\Http\Controllers;
use App\Cawangan;
use App\CawanganDetail;
use App\Customer;
use App\Gadai;
use App\Marhun;
use DateTime;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Services\Reports\GadaianService as ReportGadaianService;
class ReportGadaiController extends Controller
{
public function getLaporanCawangan(string $kod_cawangan, Request $request)
{
$reportGadaianService = new ReportGadaianService($kod_cawangan, $request);
return $reportGadaianService->getCawanganReport();
}
public function getSummaryLaporanGadai(Request $request)
{
$onDate = $request->onDate;
$startDate = $request->startDate;
$endDate = $request->endDate;
$active_cawangan_db_connection = getActiveCawanganDbConnection();
$active_cawangan_db_name = array_map(function ($db_connection) {
return config('database.connections' . '.' . $db_connection . '.' . 'database');
}, $active_cawangan_db_connection);
$active_cawangan_detail = Cawangan::select('kodcaw', 'details_caw')->whereIn('db_name', $active_cawangan_db_name)->get()->toArray();
$summary_gadaian_data = array_map(function ($db_connection) use ($request) {
$query = Gadai::on($db_connection);
$query->select(DB::raw('count(norujukan) as total_gadaian, sum(berat) as sum_berat, sum(nilaimarhun) as sum_nilai_marhun, sum(pinjaman) as sum_pinjaman'));
$query->when($request->filled('startDate') and $request->filled('endDate'), function ($q) use ($request) {
return $q->where('t_gadai', '>=', $request->startDate)
->where('t_gadai', '<=', $request->endDate);
});
return $query->get()->toArray();
}, $active_cawangan_db_connection);
$response = array_map(function ($cawangan_detail, $summary_gadaian_data) {
return array_merge($cawangan_detail, $summary_gadaian_data[0]);
}, $active_cawangan_detail, $summary_gadaian_data);
return json_encode($response);
}
}
+193
View File
@@ -0,0 +1,193 @@
<?php
namespace App\Services\Reports;
use App\Cawangan;
use App\CawanganDetail;
use App\Customer;
use App\Gadai;
use App\Marhun;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
class GadaianService
{
public $kod_cawangan;
public $startDate;
public $endDate;
public function __construct($kod_cawangan, Request $request)
{
$this->kod_cawangan = $kod_cawangan;
$this->startDate = $request->startDate;
$this->endDate = $request->endDate;
}
public function getCawanganReport()
{
$cawangan_connection = Cawangan::where('kodcaw', $this->kod_cawangan)->first()->mysql;
$query_total_gadaian = Gadai::on($cawangan_connection);
$query_total_gadaian->when(!empty($this->startDate) and !empty($this->endDate), function ($q) {
return $q->where('t_gadai', '>=', $this->startDate)
->where('t_gadai', '<=', $this->endDate);
});
$total_gadaian = $this->getTotalGadaian($query_total_gadaian);
$total_summary_gadaian_teller = $this->getTotalSummaryGadaianGroupByTeller($query_total_gadaian);
$total_summary_gadaian = $this->getTotalSummaryGadaian($query_total_gadaian);
$customer_info = $this->getCustomerInfo($total_gadaian);
$marhun_gadaian = $this->getMarhunGadaian($total_gadaian, $cawangan_connection);
$cawangan_detail = $this->getCawanganDetail($cawangan_connection);
$total_gadaian = $total_gadaian->zip($customer_info, $marhun_gadaian)->map(function ($data) {
[$gadai, $customer_info, $marhun_gadaian] = $data;
return [
'no_rujukan' => $gadai['norujukan'],
'nama' => $customer_info['nama'],
'alamat' => $customer_info['alamat1'],
'no_kp' => $gadai['nokp'],
'masa' => $gadai['masa'],
'marhun' => $marhun_gadaian,
'berat' => $gadai['berat'],
'nilai_marhun' => $gadai['nilaimarhun'],
'pembiayaan' => $gadai['pinjaman'],
'peratusan_margin_pinjaman' => $gadai['percentpinj'],
'teller' => $gadai['teller'],
];
});
$total_gadaian = $total_gadaian->groupBy('teller');
$gadaian_tellers = $total_gadaian->keys();
$total_gadaian = $total_gadaian
->zip($total_summary_gadaian_teller)
->map(function ($data) {
[$gadaian, $summary] = $data;
return [
'gadaian' => $gadaian,
'summary_gadaian_teller' => $summary,
];
});
$total_gadaian = $gadaian_tellers->combine($total_gadaian);
$data = [
'query' => [
'startDate' => formatDate($this->startDate),
'endDate' => formatDate($this->endDate),
],
'cawangan_detail' => $cawangan_detail,
'gadaian' => $total_gadaian,
'summary_gadaian' => $total_summary_gadaian,
];
return json_encode($data);
}
private function getCawanganDetail($cawangan_connection)
{
$cawangan_detail = CawanganDetail::on($cawangan_connection)->get()
->map(function ($detail) {
return [
'nama' => $detail['namacaw'],
'code' => $detail['kodcaw'] . ' Ar-Rahn ' . $detail['cawangan'],
'alamat' => $detail['alamat1'],
'waktu_operasi' => $detail['alamat4'],
];
});
return $cawangan_detail[0];
}
private function getTotalSummaryGadaian(Builder $query_total_gadaian)
{
$total_summary_gadaian = (clone $query_total_gadaian)
->selectRaw('sum(berat) as total_berat, sum(nilaimarhun) as total_nilai_marhun, sum(pinjaman) as total_pembiayaan')
->get()
->map(function ($x) {
return [
'total_berat' => $x['total_berat'],
'total_nilai_marhun' => $x['total_nilai_marhun'],
'total_pembiayaan' => $x['total_pembiayaan'],
];
});
return $total_summary_gadaian[0];
}
private function getTotalSummaryGadaianGroupByTeller(Builder $query_total_gadaian)
{
$total_summary_gadaian_groupByTeller = (clone $query_total_gadaian)
->selectRaw('sum(berat) as total_berat, sum(nilaimarhun) as total_nilai_marhun, sum(pinjaman) as total_pembiayaan')
->groupBy('teller')
->get();
return $total_summary_gadaian_groupByTeller;
}
private function getTotalGadaian(Builder $query_total_gadaian)
{
$total_gadaian = (clone $query_total_gadaian)
->select('t_gadai', 'norujukan', 'nokp', 'semakbarcode', 'masa', 'berat', 'nilaimarhun', 'pinjaman', 'upah12', 'percentpinj', 'teller', 'nokp')
->orderBy('teller')
->orderBy('sirig')
->get();
return $total_gadaian;
}
private function getCustomerInfo($total_gadaian)
{
$extract_nokp = $total_gadaian->pluck('nokp');
$customer_info = Customer::on('mysql7')
->select(['nama', 'alamat1', 'kpbaru', 'kplama'])
->where(function ($query) use ($extract_nokp) {
$query->whereIn('kpbaru', $extract_nokp)
->orWhereIn('kplama', $extract_nokp);
})
->get();
$customer_info = collect($extract_nokp)->map(function ($nokp) use ($customer_info) {
return $customer_info->where('kpbaru', $nokp)->first() ?? $customer_info->where('kplama', $nokp)->first();
})->toArray();
return $customer_info;
}
private function getMarhunGadaian($total_gadaian, $cawangan_connection)
{
$extract_norujukan = $total_gadaian->pluck('norujukan');
$marhun_gadaian = Marhun::on($cawangan_connection)
->select('norujukan', 'bil', 'marhun')
->whereIn('norujukan', $extract_norujukan)
->get()
->groupBy('norujukan')
->toArray();
$marhun_gadaian = array_map(function ($gadaian) {
return array_map(function ($norujukan) {
return $norujukan['bil'] . ' ' . $norujukan['marhun'];
}, $gadaian);
}, $marhun_gadaian);
$marhun_gadaian = array_map(function ($gadaian) {
return implode(',', $gadaian);
}, $marhun_gadaian);
return $marhun_gadaian;
}
}
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App;
use Illuminate\Support\Facades\DB;
use DateTime;
if (!function_exists('formatNumber')) {
function formatNumber ($amount) {
$formattedAmount = number_format($amount, 2, '.', ',');
return $formattedAmount;
};
}
if (!function_exists('formatDate')) {
function formatDate ($date_string) {
return (new DateTime($date_string))->format("d-m-Y");
};
}
if (!function_exists('getActiveCawanganDbConnection')) {
function getActiveCawanganDbConnection()
{
$all_active_db_keys = array_filter(array_keys(config('database.connections')), function ($connection) {
try {
DB::connection($connection)->getPdo();
return true;
} catch (\Throwable $th) {
return false;
}
});
$non_cawangan_database = ['lelong', 'online_arrahn', 'kaunterpkb'];
$all_cawangan_db = array_filter($all_active_db_keys, function ($db_key) use ($non_cawangan_database) {
$isNotCawangan = in_array(config('database.connections.' . $db_key . '.database'), $non_cawangan_database);
if ($isNotCawangan) {
return false;
}
return true;
});
return $all_cawangan_db;
}
}
+3 -1
View File
@@ -60,6 +60,7 @@ $app->singleton(
*/
$app->configure('app');
$app->configure('tinker');
/*
|--------------------------------------------------------------------------
@@ -110,6 +111,7 @@ $app->router->group([
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/web.php';
require __DIR__.'/../routes/report.php';
});
$app->middleware([
@@ -117,5 +119,5 @@ $app->middleware([
]);
$app->register(\Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class);
$app->register(\Laravel\Tinker\TinkerServiceProvider::class);
return $app;
+4
View File
@@ -8,6 +8,7 @@
"php": "^7.2.5",
"auth0/auth0-php": "^7.4",
"laravel/lumen-framework": "^7.0",
"laravel/tinker": "^2.8",
"rap2hpoutre/laravel-log-viewer": "^1.7"
},
"require-dev": {
@@ -16,6 +17,9 @@
"phpunit/phpunit": "^8.5"
},
"autoload": {
"files":[
"app/helpers.php"
],
"classmap": [
"database/seeds",
"database/factories"
Generated
+206 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f3fc95d4bf94ca7763a98f60d5a6fd91",
"content-hash": "9002d37085a4ef790b6e9f7269b8f058",
"packages": [
{
"name": "auth0/auth0-php",
@@ -2202,6 +2202,75 @@
},
"time": "2020-09-15T14:53:08+00:00"
},
{
"name": "laravel/tinker",
"version": "v2.8.2",
"source": {
"type": "git",
"url": "https://github.com/laravel/tinker.git",
"reference": "b936d415b252b499e8c3b1f795cd4fc20f57e1f3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/tinker/zipball/b936d415b252b499e8c3b1f795cd4fc20f57e1f3",
"reference": "b936d415b252b499e8c3b1f795cd4fc20f57e1f3",
"shasum": ""
},
"require": {
"illuminate/console": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/contracts": "^6.0|^7.0|^8.0|^9.0|^10.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0",
"php": "^7.2.5|^8.0",
"psy/psysh": "^0.10.4|^0.11.1",
"symfony/var-dumper": "^4.3.4|^5.0|^6.0"
},
"require-dev": {
"mockery/mockery": "~1.3.3|^1.4.2",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^8.5.8|^9.3.3"
},
"suggest": {
"illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0|^9.0|^10.0)."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
},
"laravel": {
"providers": [
"Laravel\\Tinker\\TinkerServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Laravel\\Tinker\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "Powerful REPL for the Laravel framework.",
"keywords": [
"REPL",
"Tinker",
"laravel",
"psysh"
],
"support": {
"issues": "https://github.com/laravel/tinker/issues",
"source": "https://github.com/laravel/tinker/tree/v2.8.2"
},
"time": "2023-08-15T14:27:00+00:00"
},
{
"name": "monolog/monolog",
"version": "2.6.0",
@@ -2453,6 +2522,62 @@
},
"time": "2018-02-13T20:26:39+00:00"
},
{
"name": "nikic/php-parser",
"version": "v4.17.1",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d",
"reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=7.0"
},
"require-dev": {
"ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0"
},
"bin": [
"bin/php-parse"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.9-dev"
}
},
"autoload": {
"psr-4": {
"PhpParser\\": "lib/PhpParser"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov"
}
],
"description": "A PHP parser written in PHP",
"keywords": [
"parser",
"php"
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1"
},
"time": "2023-08-13T19:53:39+00:00"
},
{
"name": "opis/closure",
"version": "3.6.3",
@@ -2893,6 +3018,86 @@
},
"time": "2017-10-23T01:57:42+00:00"
},
{
"name": "psy/psysh",
"version": "v0.11.22",
"source": {
"type": "git",
"url": "https://github.com/bobthecow/psysh.git",
"reference": "128fa1b608be651999ed9789c95e6e2a31b5802b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/128fa1b608be651999ed9789c95e6e2a31b5802b",
"reference": "128fa1b608be651999ed9789c95e6e2a31b5802b",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-tokenizer": "*",
"nikic/php-parser": "^4.0 || ^3.1",
"php": "^8.0 || ^7.0.8",
"symfony/console": "^6.0 || ^5.0 || ^4.0 || ^3.4",
"symfony/var-dumper": "^6.0 || ^5.0 || ^4.0 || ^3.4"
},
"conflict": {
"symfony/console": "4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.2"
},
"suggest": {
"ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)",
"ext-pdo-sqlite": "The doc command requires SQLite to work.",
"ext-posix": "If you have PCNTL, you'll want the POSIX extension as well.",
"ext-readline": "Enables support for arrow-key history navigation, and showing and manipulating command history."
},
"bin": [
"bin/psysh"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-0.11": "0.11.x-dev"
},
"bamarni-bin": {
"bin-links": false,
"forward-command": false
}
},
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Psy\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Justin Hileman",
"email": "justin@justinhileman.info",
"homepage": "http://justinhileman.com"
}
],
"description": "An interactive shell for modern PHP.",
"homepage": "http://psysh.org",
"keywords": [
"REPL",
"console",
"interactive",
"shell"
],
"support": {
"issues": "https://github.com/bobthecow/psysh/issues",
"source": "https://github.com/bobthecow/psysh/tree/v0.11.22"
},
"time": "2023-10-14T21:56:36+00:00"
},
{
"name": "ralouphie/getallheaders",
"version": "3.0.3",
+44
View File
@@ -0,0 +1,44 @@
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": "^7.2.5",
"auth0/auth0-php": "^7.4",
"laravel/lumen-framework": "^7.0",
"rap2hpoutre/laravel-log-viewer": "^1.7"
},
"require-dev": {
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"phpunit/phpunit": "^8.5"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
}
}
+7182
View File
File diff suppressed because it is too large Load Diff
+60
View File
@@ -0,0 +1,60 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Laravel CORS Options
|--------------------------------------------------------------------------
|
| The allowed_methods and allowed_headers options are case-insensitive.
|
| You don't need to provide both allowed_origins and allowed_origins_patterns.
| If one of the strings passed matches, it is considered a valid origin.
|
| If ['*'] is provided to allowed_methods, allowed_origins or allowed_headers
| all methods / origins / headers are allowed.
|
*/
/*
* You can enable CORS for 1 or multiple paths.
* Example: ['api/*']
*/
'paths' => ['api/*'],
/*
* Matches the request method. `['*']` allows all methods.
*/
'allowed_methods' => ['*'],
/*
* Matches the request origin. `['*']` allows all origins. Wildcards can be used, eg `*.mydomain.com`
*/
'allowed_origins' => ['*'],
/*
* Patterns that can be used with `preg_match` to match the origin.
*/
'allowed_origins_patterns' => [],
/*
* Sets the Access-Control-Allow-Headers response header. `['*']` allows all headers.
*/
'allowed_headers' => ['*'],
/*
* Sets the Access-Control-Expose-Headers response header with these headers.
*/
'exposed_headers' => [],
/*
* Sets the Access-Control-Max-Age response header when > 0.
*/
'max_age' => 86400,
/*
* Sets the Access-Control-Allow-Credentials header.
*/
'supports_credentials' => true,
];
+50
View File
@@ -0,0 +1,50 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Console Commands
|--------------------------------------------------------------------------
|
| This option allows you to add additional Artisan commands that should
| be available within the Tinker environment. Once the command is in
| this array you may execute the command in Tinker using its name.
|
*/
'commands' => [
// App\Console\Commands\ExampleCommand::class,
],
/*
|--------------------------------------------------------------------------
| Auto Aliased Classes
|--------------------------------------------------------------------------
|
| Tinker will not automatically alias classes in your vendor namespaces
| but you may explicitly allow a subset of classes to get aliased by
| adding the names of each of those classes to the following list.
|
*/
'alias' => [
//
],
/*
|--------------------------------------------------------------------------
| Classes That Should Not Be Aliased
|--------------------------------------------------------------------------
|
| Typically, Tinker automatically aliases classes as you require them in
| Tinker. However, you may wish to never alias certain classes, which
| you may accomplish by listing the classes in the following array.
|
*/
'dont_alias' => [
'App\Nova',
],
];
+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());
}
}
}
+6
View File
@@ -0,0 +1,6 @@
<?php
$router->group(['prefix'=>'api'], function () use ($router){
$router->get('gadailaporanOverallSummary', ['uses' => 'ReportGadaiController@getSummaryLaporanGadai']);
$router->get('gadailaporan/{kod_cawangan}', ['uses' => 'ReportGadaiController@getLaporanCawangan']);
});
+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();
?>