Create a file like the following in app/commands, replace my comment in the fire method with your update function.
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class setCreditToZero extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'set:zero';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
// your update function here
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return [
];
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return [
];
}
}
Register your command in app/start/artisan.php
Artisan::add(new setCreditToZero);
Now set a cronjob using command on your terminal
crontab -e
And in this file set a cronjob with this line
0 0 * * * /usr/bin/php /path/to/laravel/baseDir/artisan set:zero
And you should be good to go