链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

61 lines
1.3 KiB

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Models\ImsCjdcStore;
use Carbon\Carbon;
class TransSQTimeToAdd extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'command:TransSQTimeToAdd';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command 转换申请时间到time_add';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$stores = ImsCjdcStore::all();
foreach ($stores as $key => $store) {
# code...
$d = new Carbon($store->rzdq_time);
//dd($d->subDays(1000));
$nd = $d->subDays(1000)->toDateTimeString();
$store->time_add = $nd;
$store->save();
}
// $store = ImsCjdcStore::find(1);
// $d = new Carbon($store->rzdq_time);
// $nd = $d->subDays(1000)->toDateTimeString();
// $store->time_add = $nd;
// $store->save();
return 0;
}
}