Browse Source

迁移店铺时间

master
Mike 5 years ago
parent
commit
6385171f11
  1. 61
      app/Console/Commands/TransSQTimeToAdd.php

61
app/Console/Commands/TransSQTimeToAdd.php

@ -0,0 +1,61 @@
<?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;
}
}
Loading…
Cancel
Save