Apply fixes from StyleCI
This commit is contained in:
@@ -69,7 +69,7 @@ class ApiController extends Controller
|
||||
public $source;
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
@@ -134,6 +134,7 @@ class ApiController extends Controller
|
||||
* @method POST
|
||||
*
|
||||
* @param user_id,subject,body,helptopic,sla,priority,dept
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function createTicket(\App\Http\Requests\helpdesk\CreateTicketRequest $request, \App\Model\helpdesk\Utility\CountryCode $code)
|
||||
@@ -193,7 +194,8 @@ class ApiController extends Controller
|
||||
/**
|
||||
* Reply for the ticket.
|
||||
*
|
||||
* @param TicketRequest $request
|
||||
* @param TicketRequest $request
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
public function ticketReply()
|
||||
@@ -201,7 +203,7 @@ class ApiController extends Controller
|
||||
//dd($this->request->all());
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
'reply_content' => 'required',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
@@ -239,11 +241,11 @@ class ApiController extends Controller
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
'subject' => 'required',
|
||||
'sla_plan' => 'required|exists:sla_plan,id',
|
||||
'help_topic' => 'required|exists:help_topic,id',
|
||||
'ticket_source' => 'required|exists:ticket_source,id',
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
'subject' => 'required',
|
||||
'sla_plan' => 'required|exists:sla_plan,id',
|
||||
'help_topic' => 'required|exists:help_topic,id',
|
||||
'ticket_source' => 'required|exists:ticket_source,id',
|
||||
'ticket_priority' => 'required|exists:ticket_priority,priority_id',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
@@ -511,7 +513,7 @@ class ApiController extends Controller
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'ticket_id' => 'required',
|
||||
'user' => 'required',
|
||||
'user' => 'required',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
@@ -731,7 +733,7 @@ class ApiController extends Controller
|
||||
}
|
||||
|
||||
$url = $this->request->input('url');
|
||||
if (! Str::is('*/', $url)) {
|
||||
if (!Str::is('*/', $url)) {
|
||||
$url = Str::finish($url, '/');
|
||||
}
|
||||
|
||||
@@ -763,7 +765,8 @@ class ApiController extends Controller
|
||||
/**
|
||||
* Call curl function for Get Method.
|
||||
*
|
||||
* @param type $url
|
||||
* @param type $url
|
||||
*
|
||||
* @return type int|string|json
|
||||
*/
|
||||
public function callGetApi($url)
|
||||
@@ -786,8 +789,9 @@ class ApiController extends Controller
|
||||
/**
|
||||
* Call curl function for POST Method.
|
||||
*
|
||||
* @param type $url
|
||||
* @param type $data
|
||||
* @param type $url
|
||||
* @param type $data
|
||||
*
|
||||
* @return type int|string|json
|
||||
*/
|
||||
public function callPostApi($url, $data)
|
||||
@@ -1025,9 +1029,9 @@ class ApiController extends Controller
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($this->request->all(), [
|
||||
'user_id' => 'required|exists:users,id',
|
||||
'user_id' => 'required|exists:users,id',
|
||||
'ticket_id' => 'required|exists:tickets,id',
|
||||
'body' => 'required',
|
||||
'body' => 'required',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
$error = $v->errors();
|
||||
@@ -1256,7 +1260,7 @@ class ApiController extends Controller
|
||||
return response()->json(compact('error'));
|
||||
}
|
||||
$id = $this->request->input('ticket_id');
|
||||
if (! $this->model->where('id', $id)->first()) {
|
||||
if (!$this->model->where('id', $id)->first()) {
|
||||
$error = 'There is no Ticket as ticket id: '.$id;
|
||||
|
||||
return response()->json(compact('error'));
|
||||
@@ -1315,7 +1319,7 @@ class ApiController extends Controller
|
||||
$result['duedate'] = date_add($result2->created_at, date_interval_create_from_date_string($result2->grace_period))->format('Y:m:d H:i:s');
|
||||
$result['title'] = utfEncoding(Ticket_Thread::where('ticket_id', $id)->orderBy('id')->first()->title);
|
||||
$assigned = Tickets::where('id', $id)->select('assigned_to', 'team_id')->first()->toArray();
|
||||
if (! empty($assigned)) {
|
||||
if (!empty($assigned)) {
|
||||
if ($assigned['assigned_to'] != null) {
|
||||
$result['assignee'] = User::where('id', $assigned['assigned_to'])->first()->name();
|
||||
} elseif ($assigned['team_id'] != null) {
|
||||
@@ -1421,7 +1425,7 @@ class ApiController extends Controller
|
||||
$v = \Validator::make(
|
||||
Input::all(),
|
||||
[
|
||||
'email' => 'required|email|unique:users',
|
||||
'email' => 'required|email|unique:users',
|
||||
'ticket_id' => 'required',
|
||||
]
|
||||
);
|
||||
@@ -1487,7 +1491,7 @@ class ApiController extends Controller
|
||||
Input::all(),
|
||||
[
|
||||
'ticketid' => 'required',
|
||||
'email' => 'required',
|
||||
'email' => 'required',
|
||||
]
|
||||
);
|
||||
if ($v->fails()) {
|
||||
@@ -1557,10 +1561,10 @@ class ApiController extends Controller
|
||||
$depend = collect([['name' => 'unassigned', 'count' => $unassigned], ['name' => 'mytickets', 'count' => $mytickets]]);
|
||||
$collection = $statuses->merge($depend);
|
||||
$result = ['departments' => $department, 'sla' => $sla, 'staffs' => $staff, 'teams' => $team,
|
||||
'priorities' => $priority, 'helptopics' => $helptopic,
|
||||
'status' => $status,
|
||||
'sources' => $source,
|
||||
'tickets_count' => $collection, ];
|
||||
'priorities' => $priority, 'helptopics' => $helptopic,
|
||||
'status' => $status,
|
||||
'sources' => $source,
|
||||
'tickets_count' => $collection, ];
|
||||
|
||||
return response()->json(compact('result'));
|
||||
// $result = ['departments' => $department, 'sla' => $sla, 'staffs' => $staff, 'teams' => $team,
|
||||
@@ -1584,10 +1588,10 @@ class ApiController extends Controller
|
||||
if ($ticket->dept_id && $ticket->help_topic_id) {
|
||||
return $this->getSystem($check, $query);
|
||||
}
|
||||
if (! $ticket->dept_id && $ticket->help_topic_id) {
|
||||
if (!$ticket->dept_id && $ticket->help_topic_id) {
|
||||
return $query->select('tickets.help_topic_id');
|
||||
}
|
||||
if ($ticket->dept_id && ! $ticket->help_topic_id) {
|
||||
if ($ticket->dept_id && !$ticket->help_topic_id) {
|
||||
return $query->select('tickets.dept_id');
|
||||
}
|
||||
}
|
||||
@@ -1610,14 +1614,15 @@ class ApiController extends Controller
|
||||
/**
|
||||
* Register a user with username and password.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
try {
|
||||
$v = \Validator::make($request->all(), [
|
||||
'email' => 'required|email|unique:users',
|
||||
'email' => 'required|email|unique:users',
|
||||
'password' => 'required|min:6',
|
||||
]);
|
||||
if ($v->fails()) {
|
||||
@@ -1654,7 +1659,7 @@ class ApiController extends Controller
|
||||
$v = \Validator::make(
|
||||
$this->request->all(),
|
||||
[
|
||||
'username' => 'required|unique:users,user_name',
|
||||
'username' => 'required|unique:users,user_name',
|
||||
'first_name' => 'required',
|
||||
]
|
||||
);
|
||||
|
@@ -35,7 +35,7 @@ class ApiExceptAuthController extends Controller
|
||||
}
|
||||
|
||||
$url = $this->request->input('url');
|
||||
if (! Str::is('*/', $url)) {
|
||||
if (!Str::is('*/', $url)) {
|
||||
$url = Str::finish($url, '/');
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ class ApiExceptAuthController extends Controller
|
||||
/**
|
||||
* Call curl function for Get Method.
|
||||
*
|
||||
* @param type $url
|
||||
* @param type $url
|
||||
*
|
||||
* @return type int|string|json
|
||||
*/
|
||||
public function callGetApi($url)
|
||||
@@ -95,8 +96,9 @@ class ApiExceptAuthController extends Controller
|
||||
/**
|
||||
* Call curl function for POST Method.
|
||||
*
|
||||
* @param type $url
|
||||
* @param type $data
|
||||
* @param type $url
|
||||
* @param type $data
|
||||
*
|
||||
* @return type int|string|json
|
||||
*/
|
||||
public function callPostApi($url, $data)
|
||||
|
@@ -37,21 +37,21 @@ class InstallerApiController extends Controller
|
||||
public function config_database(Request $request)
|
||||
{
|
||||
$rules = [
|
||||
'database' => 'required|min:1',
|
||||
'host' => 'required',
|
||||
'database' => 'required|min:1',
|
||||
'host' => 'required',
|
||||
'databasename' => 'required|min:1',
|
||||
'dbusername' => 'required|min:1',
|
||||
'dbusername' => 'required|min:1',
|
||||
];
|
||||
if ($request->port) {
|
||||
$rules['port'] = 'integer|min:0';
|
||||
}
|
||||
$validator = \Validator::make(
|
||||
[
|
||||
'database' => $request->database,
|
||||
'host' => $request->host,
|
||||
'database' => $request->database,
|
||||
'host' => $request->host,
|
||||
'databasename' => $request->databasename,
|
||||
'dbusername' => $request->dbusername,
|
||||
'port' => $request->port,
|
||||
'dbusername' => $request->dbusername,
|
||||
'port' => $request->port,
|
||||
],
|
||||
$rules
|
||||
);
|
||||
@@ -132,21 +132,21 @@ class InstallerApiController extends Controller
|
||||
$validator = \Validator::make(
|
||||
[
|
||||
'firstname' => $request->firstname,
|
||||
'lastname' => $request->lastname,
|
||||
'email' => $request->email,
|
||||
'username' => $request->username,
|
||||
'password' => $request->password,
|
||||
'timezone' => $request->timezone,
|
||||
'datetime' => $request->datetime,
|
||||
'lastname' => $request->lastname,
|
||||
'email' => $request->email,
|
||||
'username' => $request->username,
|
||||
'password' => $request->password,
|
||||
'timezone' => $request->timezone,
|
||||
'datetime' => $request->datetime,
|
||||
],
|
||||
[
|
||||
'firstname' => 'required|alpha|min:1',
|
||||
'lastname' => 'required|alpha|min:1',
|
||||
'email' => 'required|email|min:1',
|
||||
'username' => 'required|min:4',
|
||||
'password' => 'required|min:6',
|
||||
'timezone' => 'required|min:1',
|
||||
'datetime' => 'required|min:1',
|
||||
'lastname' => 'required|alpha|min:1',
|
||||
'email' => 'required|email|min:1',
|
||||
'username' => 'required|min:4',
|
||||
'password' => 'required|min:6',
|
||||
'timezone' => 'required|min:1',
|
||||
'datetime' => 'required|min:1',
|
||||
]
|
||||
);
|
||||
if ($validator->fails()) {
|
||||
@@ -202,15 +202,15 @@ class InstallerApiController extends Controller
|
||||
|
||||
// Creating user
|
||||
$user = User::create([
|
||||
'first_name' => $firstname,
|
||||
'last_name' => $lastname,
|
||||
'email' => $email,
|
||||
'user_name' => $username,
|
||||
'password' => Hash::make($password),
|
||||
'active' => 1,
|
||||
'role' => 'admin',
|
||||
'first_name' => $firstname,
|
||||
'last_name' => $lastname,
|
||||
'email' => $email,
|
||||
'user_name' => $username,
|
||||
'password' => Hash::make($password),
|
||||
'active' => 1,
|
||||
'role' => 'admin',
|
||||
'assign_group' => 1,
|
||||
'primary_dpt' => 1,
|
||||
'primary_dpt' => 1,
|
||||
]);
|
||||
|
||||
// Setting database installed status
|
||||
|
@@ -46,12 +46,13 @@ class TicketController extends Controller
|
||||
/**
|
||||
* Create Ticket.
|
||||
*
|
||||
* @param type $user_id
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $helptopic
|
||||
* @param type $sla
|
||||
* @param type $priority
|
||||
* @param type $user_id
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $helptopic
|
||||
* @param type $sla
|
||||
* @param type $priority
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function createTicket($user_id, $subject, $body, $helptopic, $sla, $priority, $source, $headers, $dept, $assignto, $form_data, $attach = '')
|
||||
@@ -101,7 +102,7 @@ class TicketController extends Controller
|
||||
$this->storeCollaborators($headers, $id);
|
||||
|
||||
$thread = $this->ticketThread($subject, $body, $id, $user_id);
|
||||
if (! empty($attach)) {
|
||||
if (!empty($attach)) {
|
||||
$this->attach($thread, $attach);
|
||||
}
|
||||
|
||||
@@ -114,7 +115,8 @@ class TicketController extends Controller
|
||||
/**
|
||||
* store_collaborators.
|
||||
*
|
||||
* @param type $headers
|
||||
* @param type $headers
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function storeCollaborators($headers, $id)
|
||||
@@ -164,10 +166,11 @@ class TicketController extends Controller
|
||||
/**
|
||||
* Generate Ticket Thread.
|
||||
*
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $id
|
||||
* @param type $user_id
|
||||
* @param type $subject
|
||||
* @param type $body
|
||||
* @param type $id
|
||||
* @param type $user_id
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function ticketThread($subject, $body, $id, $user_id)
|
||||
@@ -190,7 +193,8 @@ class TicketController extends Controller
|
||||
/**
|
||||
* Generates Ticket Number.
|
||||
*
|
||||
* @param type $ticket_number
|
||||
* @param type $ticket_number
|
||||
*
|
||||
* @return type integer
|
||||
*/
|
||||
public function ticketNumber($ticket_number)
|
||||
@@ -230,7 +234,8 @@ class TicketController extends Controller
|
||||
/**
|
||||
* Generate a random string for password.
|
||||
*
|
||||
* @param type $length
|
||||
* @param type $length
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function generateRandomString($length = 10)
|
||||
@@ -254,6 +259,7 @@ class TicketController extends Controller
|
||||
*
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type TicketRequest $request
|
||||
*
|
||||
* @return type bool
|
||||
*/
|
||||
public function reply($thread, $request, $ta, $attach = '')
|
||||
@@ -299,7 +305,7 @@ class TicketController extends Controller
|
||||
}
|
||||
$thread->save();
|
||||
|
||||
if (! empty($attach)) {
|
||||
if (!empty($attach)) {
|
||||
$check_attachment = $this->attach($thread->id, $attach);
|
||||
}
|
||||
|
||||
@@ -312,7 +318,7 @@ class TicketController extends Controller
|
||||
$ticket_number = $tickets->ticket_number;
|
||||
$company = $this->company();
|
||||
$username = $ticket_user->user_name;
|
||||
if (! empty(Auth::user()->agent_sign)) {
|
||||
if (!empty(Auth::user()->agent_sign)) {
|
||||
$agentsign = Auth::user()->agent_sign;
|
||||
} else {
|
||||
$agentsign = null;
|
||||
@@ -398,8 +404,9 @@ class TicketController extends Controller
|
||||
/**
|
||||
* Ticket edit and save ticket data.
|
||||
*
|
||||
* @param type $ticket_id
|
||||
* @param type $ticket_id
|
||||
* @param type Ticket_Thread $thread
|
||||
*
|
||||
* @return type bool
|
||||
*/
|
||||
public function ticketEditPost($ticket_id, $thread, $ticket)
|
||||
@@ -430,7 +437,8 @@ class TicketController extends Controller
|
||||
/**
|
||||
* function to assign ticket.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type $id
|
||||
*
|
||||
* @return type bool
|
||||
*/
|
||||
public function assign($id)
|
||||
@@ -440,19 +448,19 @@ class TicketController extends Controller
|
||||
//dd($UserEmail);
|
||||
// $UserEmail = 'sujitprasad12@yahoo.in';
|
||||
$user = User::where('email', '=', $UserEmail)->first();
|
||||
if (! $user) {
|
||||
if (!$user) {
|
||||
return ['error' => 'No agent not found'];
|
||||
}
|
||||
$user_id = $user->id;
|
||||
$ticket = Tickets::where('id', '=', $id)->first();
|
||||
if (! $ticket) {
|
||||
if (!$ticket) {
|
||||
return ['error' => 'No ticket not found'];
|
||||
}
|
||||
$ticket_number = $ticket->ticket_number;
|
||||
$ticket->assigned_to = $user_id;
|
||||
$ticket->save();
|
||||
$ticket_thread = Ticket_Thread::where('ticket_id', '=', $id)->first();
|
||||
if (! $ticket_thread) {
|
||||
if (!$ticket_thread) {
|
||||
return ['error' => 'No thread not found'];
|
||||
}
|
||||
$ticket_subject = $ticket_thread->title;
|
||||
@@ -492,8 +500,9 @@ class TicketController extends Controller
|
||||
/**
|
||||
* Function to delete ticket.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type $id
|
||||
* @param type Tickets $ticket
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function delete($ids, $ticket)
|
||||
@@ -546,7 +555,8 @@ class TicketController extends Controller
|
||||
/**
|
||||
* check email for dublicate entry.
|
||||
*
|
||||
* @param type $email
|
||||
* @param type $email
|
||||
*
|
||||
* @return type bool
|
||||
*/
|
||||
public function checkEmail($email)
|
||||
@@ -587,8 +597,9 @@ class TicketController extends Controller
|
||||
/**
|
||||
* Create Attachment.
|
||||
*
|
||||
* @param type $thread
|
||||
* @param type $attach
|
||||
* @param type $thread
|
||||
* @param type $attach
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function attach($thread, $attach)
|
||||
@@ -623,6 +634,7 @@ class TicketController extends Controller
|
||||
* useradd.
|
||||
*
|
||||
* @param type Image $image
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function useradd()
|
||||
|
@@ -38,7 +38,8 @@ class TokenAuthController extends Controller
|
||||
/**
|
||||
* Authenticating user with username and password and retuen token.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function authenticate(Request $request)
|
||||
@@ -50,7 +51,7 @@ class TokenAuthController extends Controller
|
||||
//$credentials = $request->only('email', 'password');
|
||||
|
||||
try {
|
||||
if (! $token = JWTAuth::attempt([$field => $usernameinput, 'password' => $password, 'active' => 1])) {
|
||||
if (!$token = JWTAuth::attempt([$field => $usernameinput, 'password' => $password, 'active' => 1])) {
|
||||
return response()->json(['error' => 'invalid_credentials', 'status_code' => 401]);
|
||||
}
|
||||
} catch (JWTException $e) {
|
||||
@@ -75,7 +76,7 @@ class TokenAuthController extends Controller
|
||||
{
|
||||
//dd(JWTAuth::parseToken()->authenticate());
|
||||
try {
|
||||
if (! $user = JWTAuth::parseToken()->authenticate()) {
|
||||
if (!$user = JWTAuth::parseToken()->authenticate()) {
|
||||
return response()->json(['user_not_found', 404]);
|
||||
}
|
||||
} catch (Tymon\JWTAuth\Exceptions\TokenExpiredException $e) {
|
||||
@@ -96,7 +97,8 @@ class TokenAuthController extends Controller
|
||||
/**
|
||||
* Register a user with username and password.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
// public function register(Request $request)
|
||||
|
Reference in New Issue
Block a user