update online

This commit is contained in:
afiq
2021-06-10 13:33:37 +08:00
parent 1969384132
commit 6db54b7c57
2 changed files with 50 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
class updateOnline extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update:online';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Update Online for every active gadai';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$updateOnline = Http::get(config('api.url') . '/api/transaction/online/update')->json();
if($updateOnline == 'successful'){
return 0;
}else{
return 'failed';
}
}
}
+2
View File
@@ -15,6 +15,7 @@ class Kernel extends ConsoleKernel
protected $commands = [
Commands\resetRoleDaily::class,
Commands\updateJbg::class,
Commands\updateOnline::class,
];
/**
@@ -27,6 +28,7 @@ class Kernel extends ConsoleKernel
{
$schedule->command('reset:dailyrole')->daily()->timezone('Asia/Kuala_Lumpur')->at('00:01');
$schedule->command('update:jbg')->daily()->timezone('Asia/Kuala_Lumpur')->at('00:01');
$schedule->command('update:online')->daily()->timezone('Asia/Kuala_Lumpur')->everyFifteenMinutes();
}
/**