1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers; |
4
|
|
|
|
5
|
|
|
use App\Model\helpdesk\Ticket\Tickets; |
6
|
|
|
|
7
|
|
|
class HomeController extends Controller |
8
|
|
|
{ |
9
|
|
|
/* |
10
|
|
|
|-------------------------------------------------------------------------- |
11
|
|
|
| Home Controller |
12
|
|
|
|-------------------------------------------------------------------------- |
13
|
|
|
| |
14
|
|
|
| This controller renders your application's "dashboard" for users that |
15
|
|
|
| are authenticated. Of course, you are free to change or remove the |
16
|
|
|
| controller as you wish. It is just here to get your app started! |
17
|
|
|
| |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Create a new controller instance. |
22
|
|
|
* |
23
|
|
|
* @return void |
|
|
|
|
24
|
|
|
*/ |
25
|
|
|
public function __construct() |
26
|
|
|
{ |
27
|
|
|
// $this->middleware('auth'); |
|
|
|
|
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Show the application dashboard to the user. |
32
|
|
|
* |
33
|
|
|
* @return Response |
34
|
|
|
*/ |
35
|
|
|
public function index() |
36
|
|
|
{ |
37
|
|
|
// ksjdckjdsnc |
38
|
|
|
return view('themes/default1/admin/dashboard'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
public function getdata() |
42
|
|
|
{ |
43
|
|
|
return \View::make('emails/notifications/agent'); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function getreport() |
47
|
|
|
{ |
48
|
|
|
return \View::make('test'); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function pushdata() |
52
|
|
|
{ |
53
|
|
|
$date2 = strtotime(date('Y-m-d')); |
54
|
|
|
$date3 = date('Y-m-d'); |
55
|
|
|
$format = 'Y-m-d'; |
56
|
|
|
$date1 = strtotime(date($format, strtotime('-1 month'.$date3))); |
57
|
|
|
|
58
|
|
|
$return = ''; |
59
|
|
|
$last = ''; |
|
|
|
|
60
|
|
|
for ($i = $date1; $i <= $date2; $i = $i + 86400) { |
61
|
|
|
$thisDate = date('Y-m-d', $i); |
62
|
|
|
|
63
|
|
|
$created = \DB::table('tickets')->select('created_at')->where('created_at', 'LIKE', '%'.$thisDate.'%')->count(); |
64
|
|
|
$closed = \DB::table('tickets')->select('closed_at')->where('closed_at', 'LIKE', '%'.$thisDate.'%')->count(); |
65
|
|
|
$reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at', 'LIKE', '%'.$thisDate.'%')->count(); |
66
|
|
|
|
67
|
|
|
$value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened]; |
68
|
|
|
$array = array_map('htmlentities', $value); |
69
|
|
|
$json = html_entity_decode(json_encode($array)); |
70
|
|
|
$return .= $json.','; |
71
|
|
|
} |
72
|
|
|
$last = rtrim($return, ','); |
73
|
|
|
|
74
|
|
|
return '['.$last.']'; |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.