startday
This commit is contained in:
78
app/Console/Commands/StartDay.php
Normal file
78
app/Console/Commands/StartDay.php
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Codexshaper\WooCommerce\Facades\Product;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use App\Setting;
|
||||||
|
use App\Article;
|
||||||
|
use App\Mylog;
|
||||||
|
use App\Stock;
|
||||||
|
use Codexshaper\WooCommerce\Models\Product as ModelsProduct;
|
||||||
|
use Codexshaper\WooCommerce\Facades\Variation;
|
||||||
|
use Codexshaper\WooCommerce\Facades\Category;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
|
||||||
|
class TestPao extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'product:startday';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'STARTDAY:';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new command instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$log = "*** STARTDAY: ";
|
||||||
|
|
||||||
|
$log .= "************** FINE *********** ";
|
||||||
|
|
||||||
|
// Select all the fields of the Stock table
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$log .= $e->getMessage();
|
||||||
|
echo "Error: " . $e->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
echo $log;
|
||||||
|
|
||||||
|
Log::channel('testpao')->notice($log);
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
// Send the email
|
||||||
|
Mail::raw($log, function ($message) {
|
||||||
|
$message->to(Mylog::getEmail());
|
||||||
|
$message->subject(Mylog::getSubjectEmail("STARTDAY"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,7 +25,7 @@ class Kernel extends ConsoleKernel
|
|||||||
*/
|
*/
|
||||||
protected function schedule(Schedule $schedule)
|
protected function schedule(Schedule $schedule)
|
||||||
{
|
{
|
||||||
|
|
||||||
Log::info('Controllo schedule...');
|
Log::info('Controllo schedule...');
|
||||||
// $schedule->command('inspire')->hourly();
|
// $schedule->command('inspire')->hourly();
|
||||||
$schedule->command('backup:clean')->daily()->at('02:00')->before(function () {
|
$schedule->command('backup:clean')->daily()->at('02:00')->before(function () {
|
||||||
@@ -46,11 +46,10 @@ class Kernel extends ConsoleKernel
|
|||||||
$schedule->command('product:updateqta')->everyFiveMinutes()->between('8:00', '00:00')->withoutOverlapping()->before(function () {
|
$schedule->command('product:updateqta')->everyFiveMinutes()->between('8:00', '00:00')->withoutOverlapping()->before(function () {
|
||||||
Log::info('Running product:updateqta command');
|
Log::info('Running product:updateqta command');
|
||||||
});
|
});
|
||||||
$schedule->command('product:testpao')
|
$schedule->command('product:startday')
|
||||||
->everyFiveMinutes()
|
->daily()->at('08:00')
|
||||||
->between('8:00', '00:00')
|
|
||||||
->before(function () {
|
->before(function () {
|
||||||
Log::info('Running product:testpao command');
|
Log::info('Running product:startday command');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user