cron job
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\User;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ResetRoleAsal extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'reset:roleasal';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Reset 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::all();
|
||||
foreach($all_user as $index=>$user_kaunter){
|
||||
$user = User::find($user_kaunter->id);
|
||||
if($user->cawangan != 'operasi'){
|
||||
$user->roles = $user->role_asal;
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ class Kernel extends ConsoleKernel
|
||||
Commands\resetRoleDaily::class,
|
||||
Commands\updateJbg::class,
|
||||
Commands\updateOnline::class,
|
||||
Commands\ResetRoleAsal::class,
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -28,6 +29,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('reset:roleasal')->daily()->timezone('Asia/Kuala_Lumpur')->at('00:01');
|
||||
$schedule->command('update:online')->daily()->timezone('Asia/Kuala_Lumpur')->everyFifteenMinutes();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user