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:
@@ -40,7 +40,6 @@ class ClientTicketController extends Controller
|
||||
*
|
||||
* @param type Tickets $ticket
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function getCheckTicket(Tickets $ticket, User $user)
|
||||
@@ -51,8 +50,7 @@ class ClientTicketController extends Controller
|
||||
/**
|
||||
* reply.
|
||||
*
|
||||
* @param type $value
|
||||
*
|
||||
* @param type $value
|
||||
* @return type view
|
||||
*/
|
||||
public function reply($id, Request $request)
|
||||
|
@@ -59,7 +59,6 @@ class FormController extends Controller
|
||||
* getform.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic, CountryCode $code)
|
||||
@@ -69,7 +68,7 @@ class FormController extends Controller
|
||||
}
|
||||
$settings = CommonSettings::select('status')->where('option_name', '=', 'send_otp')->first();
|
||||
$email_mandatory = CommonSettings::select('status')->where('option_name', '=', 'email_mandatory')->first();
|
||||
if (!\Auth::check() && ($settings->status == 1 || $settings->status == '1')) {
|
||||
if (! \Auth::check() && ($settings->status == 1 || $settings->status == '1')) {
|
||||
return redirect('auth/login')->with(['login_require' => 'Please login to your account for submitting a ticket', 'referer' => 'form']);
|
||||
}
|
||||
$location = GeoIP::getLocation();
|
||||
@@ -96,7 +95,6 @@ class FormController extends Controller
|
||||
*
|
||||
* @param type Form_name $name
|
||||
* @param type Form_details $details
|
||||
*
|
||||
* @return type string
|
||||
*/
|
||||
public function postForm($id, Help_topic $topic)
|
||||
@@ -105,7 +103,7 @@ class FormController extends Controller
|
||||
$helptopic = $topic->where('id', '=', $id)->first();
|
||||
$custom_form = $helptopic->custom_form;
|
||||
$values = Fields::where('forms_id', '=', $custom_form)->get();
|
||||
if (!$values) {
|
||||
if (! $values) {
|
||||
}
|
||||
if ($values) {
|
||||
foreach ($values as $form_data) {
|
||||
@@ -188,7 +186,7 @@ class FormController extends Controller
|
||||
// $priority = $ticket_settings->first()->priority;
|
||||
$default_priority = Ticket_Priority::where('is_default', '=', 1)->first();
|
||||
$user_priority = CommonSettings::where('option_name', '=', 'user_priority')->first();
|
||||
if (!($request->input('priority'))) {
|
||||
if (! ($request->input('priority'))) {
|
||||
$priority = $default_priority->priority_id;
|
||||
if ($helpTopicObj->exists() && ($helpTopicObj->value('status') == 1)) {
|
||||
$priority = $helpTopicObj->value('priority');
|
||||
@@ -210,18 +208,18 @@ class FormController extends Controller
|
||||
$geoipcode = $code->where('iso', '=', $location->iso_code)->first();
|
||||
if ($phonecode == null) {
|
||||
$data = [
|
||||
'fails' => Lang::get('lang.country-code-required-error'),
|
||||
'phonecode' => $geoipcode->phonecode,
|
||||
'fails' => Lang::get('lang.country-code-required-error'),
|
||||
'phonecode' => $geoipcode->phonecode,
|
||||
'country_code_error' => 1,
|
||||
];
|
||||
|
||||
return Redirect::back()->with($data)->withInput($request->except('password'));
|
||||
} else {
|
||||
$code = CountryCode::select('phonecode')->where('phonecode', '=', $phonecode)->get();
|
||||
if (!count($code)) {
|
||||
if (! count($code)) {
|
||||
$data = [
|
||||
'fails' => Lang::get('lang.incorrect-country-code-error'),
|
||||
'phonecode' => $geoipcode->phonecode,
|
||||
'fails' => Lang::get('lang.incorrect-country-code-error'),
|
||||
'phonecode' => $geoipcode->phonecode,
|
||||
'country_code_error' => 1,
|
||||
];
|
||||
|
||||
@@ -263,15 +261,14 @@ class FormController extends Controller
|
||||
/**
|
||||
* reply.
|
||||
*
|
||||
* @param type $value
|
||||
*
|
||||
* @param type $value
|
||||
* @return type view
|
||||
*/
|
||||
public function post_ticket_reply($id, Request $request)
|
||||
{
|
||||
try {
|
||||
$comment = $request->input('comment');
|
||||
if (!empty($comment)) {
|
||||
if (! empty($comment)) {
|
||||
$tickets = Tickets::where('id', '=', $id)->first();
|
||||
$thread = Ticket_Thread::where('ticket_id', '=', $tickets->id)->first();
|
||||
|
||||
@@ -315,7 +312,7 @@ class FormController extends Controller
|
||||
$helptopic_id = $request->input('helptopic');
|
||||
$helptopics = new Help_topic();
|
||||
$helptopic = $helptopics->find($helptopic_id);
|
||||
if (!$helptopic) {
|
||||
if (! $helptopic) {
|
||||
throw new Exception('We can not find your request');
|
||||
}
|
||||
$custom_form = $helptopic->custom_form;
|
||||
|
@@ -67,15 +67,14 @@ class GuestController extends Controller
|
||||
|
||||
return view('themes.default1.client.helpdesk.profile', compact('user'))
|
||||
->with(['phonecode' => $phonecode->phonecode,
|
||||
'verify' => $status, ]);
|
||||
'verify' => $status, ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save profile data.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type $id
|
||||
* @param type ProfileRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfile(ProfileRequest $request)
|
||||
@@ -87,7 +86,7 @@ class GuestController extends Controller
|
||||
return redirect()->back()->with(['fails' => Lang::get('lang.country-code-required-error'), 'country_code_error' => 1])->withInput();
|
||||
} else {
|
||||
$code = CountryCode::select('phonecode')->where('phonecode', '=', $request->get('country_code'))->get();
|
||||
if (!count($code)) {
|
||||
if (! count($code)) {
|
||||
return redirect()->back()->with(['fails' => Lang::get('lang.incorrect-country-code-error'), 'country_code_error' => 1])->withInput();
|
||||
}
|
||||
$user->country_code = $request->country_code;
|
||||
@@ -126,7 +125,6 @@ class GuestController extends Controller
|
||||
*@category fucntion to check if mobile number is unqique or not
|
||||
*
|
||||
*@param string $mobile
|
||||
*
|
||||
*@return bool true(if mobile exists in users table)/false (if mobile does not exist in user table)
|
||||
*/
|
||||
public function checkMobile($mobile)
|
||||
@@ -147,7 +145,6 @@ class GuestController extends Controller
|
||||
* Get Ticket page.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getTicket(Help_topic $topic)
|
||||
@@ -161,7 +158,6 @@ class GuestController extends Controller
|
||||
* getform.
|
||||
*
|
||||
* @param type Help_topic $topic
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getForm(Help_topic $topic)
|
||||
@@ -184,7 +180,6 @@ class GuestController extends Controller
|
||||
* @param type Tickets $tickets
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function getMyticket()
|
||||
@@ -198,7 +193,6 @@ class GuestController extends Controller
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type Tickets $tickets
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function thread(Ticket_Thread $thread, Tickets $tickets, User $user)
|
||||
@@ -226,9 +220,8 @@ class GuestController extends Controller
|
||||
/**
|
||||
* Post porfile password.
|
||||
*
|
||||
* @param type $id
|
||||
* @param type $id
|
||||
* @param type ProfilePassword $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function postProfilePassword(ProfilePassword $request)
|
||||
@@ -255,7 +248,6 @@ class GuestController extends Controller
|
||||
*
|
||||
* @param type Ticket_Thread $thread
|
||||
* @param type TicketRequest $request
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function reply(Ticket_Thread $thread, TicketRequest $request)
|
||||
@@ -278,7 +270,6 @@ class GuestController extends Controller
|
||||
*
|
||||
* @param type Tickets $ticket
|
||||
* @param type User $user
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function getCheckTicket(Tickets $ticket, User $user)
|
||||
@@ -293,13 +284,12 @@ class GuestController extends Controller
|
||||
* @param type User $user
|
||||
* @param type Tickets $ticket
|
||||
* @param type Ticket_Thread $thread
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function PostCheckTicket(Request $request)
|
||||
{
|
||||
$validator = \Validator::make($request->all(), [
|
||||
'email' => 'required|email',
|
||||
'email' => 'required|email',
|
||||
'ticket_number' => 'required',
|
||||
]);
|
||||
if ($validator->fails()) {
|
||||
@@ -345,8 +335,7 @@ class GuestController extends Controller
|
||||
/**
|
||||
* get ticket email.
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @param type $id
|
||||
* @return type
|
||||
*/
|
||||
public function get_ticket_email($id, CommonSettings $common_settings)
|
||||
@@ -362,7 +351,6 @@ class GuestController extends Controller
|
||||
* get ticket status.
|
||||
*
|
||||
* @param type Tickets $ticket
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
public function getTicketStat(Tickets $ticket)
|
||||
@@ -409,7 +397,7 @@ class GuestController extends Controller
|
||||
->first();
|
||||
if ($otp != null) {
|
||||
$otp_length = strlen(Input::get('otp'));
|
||||
if (($otp_length == 6 && !preg_match('/[a-z]/i', Input::get('otp')))) {
|
||||
if (($otp_length == 6 && ! preg_match('/[a-z]/i', Input::get('otp')))) {
|
||||
$otp2 = Hash::make(Input::get('otp'));
|
||||
$date1 = date_format($otp->updated_at, 'Y-m-d h:i:sa');
|
||||
$date2 = date('Y-m-d h:i:sa');
|
||||
@@ -537,10 +525,10 @@ class GuestController extends Controller
|
||||
if (count($user) > 0) {
|
||||
foreach ($user as $key => $value) {
|
||||
$info->create([
|
||||
'owner' => $id,
|
||||
'owner' => $id,
|
||||
'service' => $provider,
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
'key' => $key,
|
||||
'value' => $value,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -549,7 +537,7 @@ class GuestController extends Controller
|
||||
public function changeEmail($email)
|
||||
{
|
||||
$user = \Auth::user();
|
||||
if ($user && $email && !$user->email) {
|
||||
if ($user && $email && ! $user->email) {
|
||||
$user->email = $email;
|
||||
$user->save();
|
||||
}
|
||||
|
@@ -46,7 +46,6 @@ class UnAuthController extends Controller
|
||||
* @param type User $user
|
||||
* @param type Tickets $ticket
|
||||
* @param type Ticket_Thread $thread
|
||||
*
|
||||
* @return type Response
|
||||
*/
|
||||
public function PostCheckTicket(Request $request)
|
||||
@@ -119,8 +118,7 @@ class UnAuthController extends Controller
|
||||
/**
|
||||
* generate random string token for ticket.
|
||||
*
|
||||
* @param type $length
|
||||
*
|
||||
* @param type $length
|
||||
* @return string
|
||||
*/
|
||||
public function generate_random_ticket_token($length = 10)
|
||||
@@ -138,9 +136,8 @@ class UnAuthController extends Controller
|
||||
/**
|
||||
* function to check the ticket without loggin In.
|
||||
*
|
||||
* @param type $ticket_id
|
||||
* @param type $token
|
||||
*
|
||||
* @param type $ticket_id
|
||||
* @param type $token
|
||||
* @return type view
|
||||
*/
|
||||
public function showTicketCode($ticket_id, $token)
|
||||
@@ -237,9 +234,8 @@ class UnAuthController extends Controller
|
||||
/**
|
||||
* function to change the status of the ticket.
|
||||
*
|
||||
* @param type $status
|
||||
* @param type $id
|
||||
*
|
||||
* @param type $status
|
||||
* @param type $id
|
||||
* @return string
|
||||
*/
|
||||
public function changeStatus($status, $id)
|
||||
@@ -327,7 +323,6 @@ class UnAuthController extends Controller
|
||||
*@category function to change system's language
|
||||
*
|
||||
*@param string $lang //desired language's iso code
|
||||
*
|
||||
*@return response
|
||||
*/
|
||||
public static function changeLanguage($lang)
|
||||
@@ -423,7 +418,7 @@ class UnAuthController extends Controller
|
||||
/**
|
||||
* Function to chnage user language preference.
|
||||
*
|
||||
* @param string $lang //desired language's iso code
|
||||
* @param string $lang //desired language's iso code
|
||||
*
|
||||
* @category function to change system's language
|
||||
*
|
||||
|
@@ -31,14 +31,13 @@ class UserController extends Controller
|
||||
|
||||
/**
|
||||
* @param
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function getArticle(Article $article, Category $category, Settings $settings)
|
||||
{
|
||||
$setting = $settings->first();
|
||||
$pagination = $setting->pagination;
|
||||
if (!Auth::check() || \Auth::user()->role == 'user') {
|
||||
if (! Auth::check() || \Auth::user()->role == 'user') {
|
||||
$article = $article->where('status', '1');
|
||||
}
|
||||
$article = $article->where('type', '1');
|
||||
@@ -54,10 +53,9 @@ class UserController extends Controller
|
||||
/**
|
||||
* Get excerpt from string.
|
||||
*
|
||||
* @param string $str String to get an excerpt from
|
||||
* @param int $startPos Position int string to start excerpt from
|
||||
* @param int $maxLength Maximum length the excerpt may be
|
||||
*
|
||||
* @param string $str String to get an excerpt from
|
||||
* @param int $startPos Position int string to start excerpt from
|
||||
* @param int $maxLength Maximum length the excerpt may be
|
||||
* @return string excerpt
|
||||
*/
|
||||
public static function getExcerpt($str, $startPos = 0, $maxLength = 50)
|
||||
@@ -77,11 +75,10 @@ class UserController extends Controller
|
||||
/**
|
||||
* function to search an article.
|
||||
*
|
||||
* @param \App\Http\Requests\kb\SearchRequest $request
|
||||
* @param \App\Model\kb\Category $category
|
||||
* @param \App\Model\kb\Article $article
|
||||
* @param \App\Model\kb\Settings $settings
|
||||
*
|
||||
* @param \App\Http\Requests\kb\SearchRequest $request
|
||||
* @param \App\Model\kb\Category $category
|
||||
* @param \App\Model\kb\Article $article
|
||||
* @param \App\Model\kb\Settings $settings
|
||||
* @return type view
|
||||
*/
|
||||
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings)
|
||||
@@ -113,7 +110,7 @@ class UserController extends Controller
|
||||
$date = \Carbon\Carbon::now()->toDateTimeString();
|
||||
$arti = $article->where('slug', $slug);
|
||||
|
||||
if (!Auth::check() || \Auth::user()->role == 'user') {
|
||||
if (! Auth::check() || \Auth::user()->role == 'user') {
|
||||
$arti = $arti->where('status', '1');
|
||||
$arti = $arti->where('publish_time', '<', $date);
|
||||
}
|
||||
@@ -133,7 +130,7 @@ class UserController extends Controller
|
||||
{
|
||||
/* get the article_id where category_id == current category */
|
||||
$catid = $category->where('slug', $slug)->first();
|
||||
if (!$catid) {
|
||||
if (! $catid) {
|
||||
return redirect()->back()->with('fails', Lang::get('lang.we_are_sorry_but_the_page_you_are_looking_for_can_not_be_found'));
|
||||
}
|
||||
$id = $catid->id;
|
||||
@@ -225,13 +222,12 @@ class UserController extends Controller
|
||||
* @param type Request $request
|
||||
* @param type Comment $comment
|
||||
* @param type Id $id
|
||||
*
|
||||
* @return type response
|
||||
*/
|
||||
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment)
|
||||
{
|
||||
$article = $article->where('slug', $slug)->first();
|
||||
if (!$article) {
|
||||
if (! $article) {
|
||||
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
|
||||
}
|
||||
$id = $article->id;
|
||||
|
Reference in New Issue
Block a user