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:
Shift
2023-01-03 08:25:25 +00:00
parent b535aa90eb
commit 43386fd86d
357 changed files with 15021 additions and 15193 deletions

View File

@@ -37,23 +37,37 @@ use Illuminate\Support\Collection;
class ApiController extends Controller
{
public $user;
public $request;
public $ticket;
public $model;
public $thread;
public $attach;
public $ticketRequest;
public $faveoUser;
public $team;
public $setting;
public $helptopic;
public $slaPlan;
public $department;
public $priority;
public $source;
/**
* @param Request $request
* @param Request $request
*/
public function __construct(Request $request)
{
@@ -118,7 +132,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)
@@ -178,8 +191,7 @@ class ApiController extends Controller
/**
* Reply for the ticket.
*
* @param TicketRequest $request
*
* @param TicketRequest $request
* @return json
*/
public function ticketReply()
@@ -187,7 +199,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()) {
@@ -225,11 +237,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()) {
@@ -497,7 +509,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();
@@ -717,7 +729,7 @@ class ApiController extends Controller
}
$url = $this->request->input('url');
if (!str_is('*/', $url)) {
if (! str_is('*/', $url)) {
$url = str_finish($url, '/');
}
@@ -749,8 +761,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)
@@ -773,9 +784,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)
@@ -1013,9 +1023,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();
@@ -1244,7 +1254,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'));
@@ -1303,7 +1313,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) {
@@ -1409,7 +1419,7 @@ class ApiController extends Controller
$v = \Validator::make(
\Input::get(),
[
'email' => 'required|email|unique:users',
'email' => 'required|email|unique:users',
'ticket_id' => 'required',
]
);
@@ -1475,7 +1485,7 @@ class ApiController extends Controller
\Input::get(),
[
'ticketid' => 'required',
'email' => 'required',
'email' => 'required',
]
);
if ($v->fails()) {
@@ -1544,11 +1554,11 @@ class ApiController extends Controller
->value('my_ticket');
$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, ];
$result = ['departments' => $department, 'sla' => $sla, 'staffs' => $staff, 'teams' => $team,
'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,
@@ -1572,10 +1582,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');
}
}
@@ -1598,15 +1608,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()) {
@@ -1643,7 +1652,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',
]
);