complaint_fields.php
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
use Config;
use App\Models\User;
use App\Models\Accesslog;
use App\Models\CRMCall;
use Schema;
use PDO;
use Illuminate\Database\Schema\Blueprint;
class complaint_fields extends Command {
/**
* The console command name.
*
* @var string
*/
protected $signature = 'complaint_fields';
/**
* The console command description.
*
* @var string
*/
protected $description = 'complaint_fields';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$nowts=time();
echo "\n".date('Y-m-d H:i:s')."\n";
$logdate=strtotime('0 day');
$tcol=0;$fieldsarr=array();$extrahdrarr=array();
$server_ip=env('app_ip');
$lead_form = "lead_form_details";
$central_ip=env('central_ip');
$conn = array(
'driver' => 'mysql',
'host' => $central_ip,
'database' => env('DB_DATABASE', 'kstych_flexydial'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'options' => array(
PDO::ATTR_TIMEOUT => 5,
),
);
Config::set("database.connections.conn", $conn);
if(DB::connection("conn")->getDatabaseName())
{
DB::table('complaint_fields')->truncate();
$qlist=DB::connection("conn")->select(DB::raw("SELECT * from complaint_fields"));
$userarr=array();
foreach($qlist as $qline)
{
$setstrarr=array();
$setstrarr[]="cust_band='$qline->cust_band'";
$setstrarr[]="cust_type='$qline->cust_type'";
$setstrarr[]="source_of_info='$qline->source_of_info'";
$setstrarr[]="service_type='$qline->service_type'";
$setstrarr[]="priority='$qline->priority'";
$setstrarr[]="category='$qline->category'";
$setstrarr[]="sub_category='$qline->sub_category'";
$setstrarr[]="resolving_branch='$qline->resolving_branch'";
$setstrarr[]="cust_city='$qline->cust_city'";
$setstrarr[]="acknowledge='$qline->acknowledge'";
$setstrarr[]="resolve_class_unit='$qline->resolve_class_unit'";
$setstrarr[]="rbb='$qline->rbb'";
$setstrarr[]="non_rbb='$qline->non_rbb'";
$setstrarr[]="logging_branch_name='$qline->logging_branch_name'";
$setstrarr[]="logging_branch_code='$qline->logging_branch_code'";
$setstrarr[]="resolving_branch_code='$qline->resolving_branch_code'";
$setstrarr[]="resolving_branch_w_code='$qline->resolving_branch_w_code'";
$setstrarr[]="logging_branch_w_code='$qline->logging_branch_w_code'";
$setstr=implode(",",$setstrarr);
DB::insert(DB::raw("insert into complaint_fields set $setstr"));
}
DB::connection("conn")->disconnect();
}
}
}