add migration script
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class MigrationOnePercent extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'onepercent:migrate';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Migration of One Percent';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$rollback = Artisan::call('migrate:rollback');
|
||||
$migrate = Artisan::call('migrate');
|
||||
$seeder = Artisan::call('db:seed',[
|
||||
'--class' => 'KadarUpahSeeder',
|
||||
]);
|
||||
|
||||
$this->info('The command was successfully generated!');
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Services\OnePercentServices;
|
||||
|
||||
class TestOnePercent extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'onepercent:test';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update JBG for every active gadai';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
protected $onepercentserv;
|
||||
public function __construct(OnePercentServices $onepercentserv)
|
||||
{
|
||||
$this->onepercentserv = $onepercentserv;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$pemb = $this->ask('Pembiayaan?');
|
||||
$nm = $this->ask('Nilaimarhun?');
|
||||
$ku = $this->ask('Kadarujrah?');
|
||||
$marg = $this->ask('Margin?');
|
||||
|
||||
$test = $this->onepercentserv->kiraanKeuntunganSebenar($pemb,$nm,$ku,$marg);
|
||||
|
||||
dd($test);
|
||||
return $test;
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected $commands = [
|
||||
Commands\DailyGadai::class,
|
||||
Commands\TestOnePercent::class,
|
||||
Commands\MigrationOnePercent::class,
|
||||
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user