InsertCrmArchive2.php 971 Bytes
<?php namespace App\Console\Commands;

use Illuminate\Console\Command;
//use Mail;
use DB;
use Config;

use App\Models\User;
use App\Models\Accesslog;

use App\Models\CRMCall;
use Schema;
use PDO;
use App\Models\Notification;
use App\Jobs\KHRMSLib;

use Input;
use App\Models\Sipid;
use App\Models\Kqueue;
use App\Models\Dialline;
use App\Models\Session;

use Illuminate\Database\Schema\Blueprint;

class InsertCrmArchive2 extends Command {

	/**
	 * The console command name.
	 *
	 * @var string
	 */
	protected $signature = 'InsertCrmArchive2';

	/**
	 * The console command description.
	 *
	 * @var string
	 */
	protected $description = 'Insert updated data into crmcalls_archive_2 from crmcalls';

	/**
	 * Execute the console command.
	 *
	 * @return mixed
	 */
	public function handle()
	{
		echo 'Start';

		DB::insert(DB::raw("insert into crmcalls_archive_2 select * from crmcalls_archive where id>(select max(id) from crmcalls_archive_2)"));

		echo 'End';
	}
}