mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-09-30 06:13:09 -04:00
65 lines
1.8 KiB
PHP
65 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Modules\WTIJobBoard\Console;
|
|
|
|
use Illuminate\Support\Str;
|
|
use Illuminate\Console\Command;
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Modules\WTIJobBoard\Entities\JobRequest;
|
|
use Illuminate\Support\Facades\Log;
|
|
use App\Traits\SendMail;
|
|
|
|
class POVDueReminder extends Command
|
|
{
|
|
|
|
use SendMail;
|
|
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'command:pov-due';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = "Notify creators for there POV Due";
|
|
|
|
/**
|
|
* Create a new command instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle()
|
|
{
|
|
\Modules\WTIJobBoard\Entities\JobRequest::with('track')->whereHas('category', function($query) {
|
|
$query->where('will_be_shipped', 1);
|
|
})->whereHas('tracks', function($query) {
|
|
$query->where('status_id', 4)->where('created_at', '<=', \Carbon\Carbon::now()->subDays(14)->toDateTimeString());
|
|
})->where('status','publish')->where('job_status','In Progress')->orderBy('id')->chunk(10, function ($job_requests) {
|
|
|
|
foreach ($job_requests as $key => $job_request) {
|
|
$diff = \Carbon\Carbon::now()->diff($job_request->track->created_at);
|
|
if($diff->days % 7 == 0){
|
|
$this->sendJobRequestReminder('POV Due',$job_request->creator, $job_request->asin);
|
|
Log::info('Successfully sent POV Due Email for asin:'.$job_request->asin);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|