Apply Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions. You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root. For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
This commit is contained in:
@@ -68,7 +68,7 @@ class ApiController extends Controller
|
||||
public $source;
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Request $request
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
{
|
||||
@@ -133,7 +133,6 @@ 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,8 +192,7 @@ class ApiController extends Controller
|
||||
/**
|
||||
* Reply for the ticket.
|
||||
*
|
||||
* @param TicketRequest $request
|
||||
*
|
||||
* @param TicketRequest $request
|
||||
* @return json
|
||||
*/
|
||||
public function ticketReply()
|
||||
@@ -202,7 +200,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()) {
|
||||
@@ -240,11 +238,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()) {
|
||||
@@ -512,7 +510,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();
|
||||
@@ -732,7 +730,7 @@ class ApiController extends Controller
|
||||
}
|
||||
|
||||
$url = $this->request->input('url');
|
||||
if (!Str::is('*/', $url)) {
|
||||
if (! Str::is('*/', $url)) {
|
||||
$url = Str::finish($url, '/');
|
||||
}
|
||||
|
||||
@@ -764,8 +762,7 @@ 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)
|
||||
@@ -788,9 +785,8 @@ 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)
|
||||
@@ -1028,9 +1024,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();
|
||||
@@ -1259,7 +1255,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'));
|
||||
@@ -1318,7 +1314,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) {
|
||||
@@ -1424,7 +1420,7 @@ class ApiController extends Controller
|
||||
$v = \Validator::make(
|
||||
\Input::get(),
|
||||
[
|
||||
'email' => 'required|email|unique:users',
|
||||
'email' => 'required|email|unique:users',
|
||||
'ticket_id' => 'required',
|
||||
]
|
||||
);
|
||||
@@ -1490,7 +1486,7 @@ class ApiController extends Controller
|
||||
\Input::get(),
|
||||
[
|
||||
'ticketid' => 'required',
|
||||
'email' => 'required',
|
||||
'email' => 'required',
|
||||
]
|
||||
);
|
||||
if ($v->fails()) {
|
||||
@@ -1560,10 +1556,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,
|
||||
@@ -1587,10 +1583,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');
|
||||
}
|
||||
}
|
||||
@@ -1613,15 +1609,14 @@ 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()) {
|
||||
@@ -1658,7 +1653,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