Apply fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
857d3004eb
commit
88f3df2180
@@ -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')]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,27 +2,28 @@
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use Auth;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class AuthUser {
|
||||
|
||||
class AuthUser
|
||||
{
|
||||
protected $user;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
$this->user = Auth::user();
|
||||
}
|
||||
|
||||
public function compose(View $view) {
|
||||
public function compose(View $view)
|
||||
{
|
||||
$view->with([
|
||||
'auth_user_role' => $this->user->role,
|
||||
'auth_user_id'=>$this->user->id,
|
||||
'auth_user_profile_pic'=>$this->user->profile_pic,
|
||||
'auth_name'=>$this->user->name(),
|
||||
'auth_user_active'=>$this->user->active,
|
||||
'auth_user_primary_dept'=> $this->user->primary_dept,
|
||||
'auth_user_assign_group'=>$this->user->assign_group,
|
||||
'auth_user_role' => $this->user->role,
|
||||
'auth_user_id' => $this->user->id,
|
||||
'auth_user_profile_pic' => $this->user->profile_pic,
|
||||
'auth_name' => $this->user->name(),
|
||||
'auth_user_active' => $this->user->active,
|
||||
'auth_user_primary_dept'=> $this->user->primary_dept,
|
||||
'auth_user_assign_group'=> $this->user->assign_group,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,20 +2,19 @@
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use App\Model\Update\BarNotification;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class UpdateNotification {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
class UpdateNotification
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
public function compose(View $view) {
|
||||
|
||||
public function compose(View $view)
|
||||
{
|
||||
$notification = new BarNotification();
|
||||
$notice = $notification->where('value', '!=', '')->select('value')->get();
|
||||
$view->with(['notification' => $notice]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user