This commit is contained in:
afiq
2021-02-09 11:25:16 +08:00
parent 5c6700ae22
commit 369ba4b22f
4 changed files with 163 additions and 110 deletions
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace App\Console\Commands;
use App\User;
use Illuminate\Console\Command;
class resetRoleDaily extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'reset:dailyrole';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Reset Daily Role';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$all_user = User::get();
foreach($all_user as $index=>$user_kaunter){
User::where('id','=',$user_kaunter['id'])->update(['role_harian'=>null]);
}
}
}
+2 -2
View File
@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
//
Commands\resetRoleDaily::class,
];
/**
@@ -24,7 +24,7 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
$schedule->command('reset:dailyrole')->daily()->timezone('Asia/Kuala_Lumpur')->at('00:00');
}
/**