Apply fixes from StyleCI

This commit is contained in:
Manish Verma
2016-12-13 13:14:54 +00:00
committed by StyleCI Bot
parent 857d3004eb
commit 88f3df2180
161 changed files with 4729 additions and 3879 deletions

View File

@@ -2,15 +2,15 @@
namespace App\Http\ViewComposers;
use Illuminate\View\View;
use App\Model\helpdesk\Settings\Company;
use Auth;
use App\User;
use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Agent\Department;
use App\Model\helpdesk\Settings\Company;
use App\Model\helpdesk\Ticket\Tickets;
use App\User;
use Auth;
use Illuminate\View\View;
class AgentLayout {
class AgentLayout
{
/**
* The user repository implementation.
*
@@ -24,10 +24,12 @@ class AgentLayout {
/**
* Create a new profile composer.
*
* @param
* @param
*
* @return void
*/
public function __construct(Company $company, User $users, Tickets $tickets, Department $department) {
public function __construct(Company $company, User $users, Tickets $tickets, Department $department)
{
$this->company = $company;
$this->auth = Auth::user();
$this->users = $users;
@@ -38,34 +40,39 @@ class AgentLayout {
/**
* Bind data to the view.
*
* @param View $view
* @param View $view
*
* @return void
*/
public function compose(View $view) {
public function compose(View $view)
{
$notifications = \App\Http\Controllers\Common\NotificationController::getNotifications();
$view->with([
'company' => $this->company,
'notifications' => $notifications,
'myticket' => $this->myTicket(),
'unassigned' => $this->unassigned(),
'company' => $this->company,
'notifications' => $notifications,
'myticket' => $this->myTicket(),
'unassigned' => $this->unassigned(),
'followup_ticket' => $this->followupTicket(),
'deleted' => $this->deleted(),
'tickets' => $this->inbox(),
'department' => $this->departments(),
'overdues' => $this->overdues(),
'due_today' => $this->getDueToday(),
'deleted' => $this->deleted(),
'tickets' => $this->inbox(),
'department' => $this->departments(),
'overdues' => $this->overdues(),
'due_today' => $this->getDueToday(),
]);
}
public function users() {
public function users()
{
return $this->users->select('id', 'profile_pic');
}
public function tickets() {
public function tickets()
{
return $this->tickets->select('id', 'ticket_number');
}
public function departments() {
public function departments()
{
$array = [];
$tickets = $this->tickets;
if (\Auth::user()->role == 'agent') {
@@ -82,10 +89,12 @@ class AgentLayout {
foreach ($grouped as $key => $group) {
$status[$key] = $group->keyBy('status');
}
return collect($status);
}
public function myTicket() {
public function myTicket()
{
$ticket = $this->tickets();
if ($this->auth->role == 'admin') {
return $ticket->where('assigned_to', $this->auth->id)
@@ -96,7 +105,8 @@ class AgentLayout {
}
}
public function unassigned() {
public function unassigned()
{
$ticket = $this->tickets();
if ($this->auth->role == 'admin') {
return $ticket->where('assigned_to', '=', null)
@@ -110,7 +120,8 @@ class AgentLayout {
}
}
public function followupTicket() {
public function followupTicket()
{
$ticket = $this->tickets();
if ($this->auth->role == 'admin') {
return $ticket->where('status', '1')->where('follow_up', '1')->select('id');
@@ -119,8 +130,8 @@ class AgentLayout {
}
}
public function deleted() {
public function deleted()
{
$ticket = $this->tickets();
if ($this->auth->role == 'admin') {
return $ticket->where('status', '5')->select('id');
@@ -130,19 +141,21 @@ class AgentLayout {
}
}
public function inbox() {
public function inbox()
{
$ticket = $this->tickets();
if ($this->auth->role == 'admin') {
return $ticket->whereIn('status', array(1, 7))->select('id');
return $ticket->whereIn('status', [1, 7])->select('id');
} elseif ($this->auth->role == 'agent') {
return $ticket->whereIn('status', array(1, 7))
return $ticket->whereIn('status', [1, 7])
->where('dept_id', '=', $this->auth->primary_dpt)
->orWhere('assigned_to', '=', Auth::user()->id)
->select('id');
}
}
public function overdues() {
public function overdues()
{
$ticket = $this->tickets();
if ($this->auth->role == 'admin') {
return $ticket->where('status', '=', 1)
@@ -162,24 +175,22 @@ class AgentLayout {
}
}
public function getDueToday()
{
$ticket = $this->tickets();
if ($this->auth->role == 'admin') {
return $ticket->where('status', '=', 1)
->where('status','=',1 )
->where('status', '=', 1)
->where('isanswered', '=', 0)
->whereNotNull('duedate')
->whereRaw('date(duedate) = ?', [date('Y-m-d')]);
} elseif ($this->auth->role == 'agent') {
return $ticket->where('status', '=', 1)
->where('status','=',1 )
->where('status', '=', 1)
->where('isanswered', '=', 0)
->whereNotNull('duedate')
->where('dept_id', '=', $this->auth->primary_dpt)
->whereRaw('date(duedate) = ?', [date('Y-m-d')]);
}
}
}