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',
|
||||
]
|
||||
);
|
||||
|
Reference in New Issue
Block a user