【发布时间】:2021-01-19 15:36:29
【问题描述】:
我正在使用任务计划进行通知现在我正在从工作许可表中收到所有通知,但我想要一个日期将在下周到期的通知,请帮助我该怎么做?谢谢。
工作许可表
标识 |姓名 |许可代码 |日期
通知表
标识 | permit_id
app/console/commands/CreatePermitWork
class CreatePermitWork extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'notifications:create';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Permit work notification added !';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$workpermits = WorkPermit::all();
foreach ($workpermits as $permit) {
$ids = array(['permit_id' => $permit->id]);
$this->info("inserting data ".$permit->name);
FacadesDB::table('work_permit_notifications')->insert($ids);
}
}
}
【问题讨论】: