From 915bb9d084273459205f665a00d8792a24125bad Mon Sep 17 00:00:00 2001 From: Sujit Prasad Date: Wed, 24 Feb 2016 10:17:53 -0500 Subject: [PATCH] Applied fixes from StyleCI --- app/Exceptions/Handler.php | 18 ++--- .../Agent/helpdesk/TicketController.php | 23 +++--- .../Installer/helpdesk/InstallController.php | 6 +- config/app.php | 76 +------------------ 4 files changed, 23 insertions(+), 100 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 47c03dd0d..537709b87 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -4,7 +4,6 @@ namespace App\Exceptions; // controller use App\Http\Controllers\Common\PhpMailController; - use Exception; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; @@ -19,11 +18,11 @@ class Handler extends ExceptionHandler 'Symfony\Component\HttpKernel\Exception\HttpException', ]; - /** * Create a new controller instance. * constructor to check - * 1. php mailer + * 1. php mailer. + * * @return void */ public function __construct(PhpMailController $PhpMailController) @@ -31,7 +30,6 @@ class Handler extends ExceptionHandler $this->PhpMailController = $PhpMailController; } - /** * Report or log an exception. * @@ -50,7 +48,7 @@ class Handler extends ExceptionHandler * Render an exception into an HTTP response. * * @param \Illuminate\Http\Request $request - * @param \Exception $e + * @param \Exception $e * * @return \Illuminate\Http\Response */ @@ -58,7 +56,6 @@ class Handler extends ExceptionHandler { if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) { return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); - } elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) { return response()->json(['message' => $e->getMessage(), 'code' => $e->getStatusCode()]); } @@ -71,10 +68,11 @@ class Handler extends ExceptionHandler // checking if the application is installed if (\Config::get('database.install') == 1) { // checking if the error log send to Ladybirdweb is enabled or not - if(\Config::get('app.ErrorLog') == '%1%') { - $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => 'faveo logger', 'email' => 'faveoerrorlogger@gmail.com'], $message = ['subject' => 'Faveo downloaded from github has occured error', 'scenario'=>'error-report'], $template_variables = ['e' => $e]); + if (\Config::get('app.ErrorLog') == '%1%') { + $this->PhpMailController->sendmail($from = $this->PhpMailController->mailfrom('1', '0'), $to = ['name' => 'faveo logger', 'email' => 'faveoerrorlogger@gmail.com'], $message = ['subject' => 'Faveo downloaded from github has occured error', 'scenario' => 'error-report'], $template_variables = ['e' => $e]); } } + return response()->view('errors.500', []); } } @@ -95,8 +93,10 @@ class Handler extends ExceptionHandler } /** - * function to generate oops error page + * function to generate oops error page. + * * @param \Exception $e + * * @return \Illuminate\Http\Response */ protected function renderExceptionWithWhoops(Exception $e) diff --git a/app/Http/Controllers/Agent/helpdesk/TicketController.php b/app/Http/Controllers/Agent/helpdesk/TicketController.php index 93edaf7bc..0c900ef4f 100644 --- a/app/Http/Controllers/Agent/helpdesk/TicketController.php +++ b/app/Http/Controllers/Agent/helpdesk/TicketController.php @@ -32,14 +32,14 @@ use App\Model\helpdesk\Utility\Timezones; use App\User; use Auth; use DB; -use UTC; -// classes use Exception; +// classes use Hash; use Illuminate\support\Collection; use Input; use Mail; use PDF; +use UTC; /** * TicketController. @@ -91,7 +91,7 @@ class TicketController extends Controller $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; } } else { - $string = "(no subject)"; + $string = '(no subject)'; } //collabrations $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); @@ -191,6 +191,7 @@ class TicketController extends Controller $dept = Department::where('id', '=', Auth::user()->primary_dpt)->first(); $tickets = Tickets::where('status', '=', 1)->where('isanswered', '=', 0)->where('assigned_to', '=', 0)->where('dept_id', '=', $dept->id)->get(); } + return \Datatable::collection(new Collection($tickets)) ->addColumn('id', function ($ticket) { return ""; @@ -204,7 +205,7 @@ class TicketController extends Controller $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; } } else { - $string = "(no subject)"; + $string = '(no subject)'; } //collabrations $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); @@ -316,7 +317,7 @@ class TicketController extends Controller $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; } } else { - $string = "(no subject)"; + $string = '(no subject)'; } //collabrations $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); @@ -423,7 +424,7 @@ class TicketController extends Controller $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; } } else { - $string = "(no subject)"; + $string = '(no subject)'; } //collabrations $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); @@ -540,7 +541,7 @@ class TicketController extends Controller $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; } } else { - $string = "(no subject)"; + $string = '(no subject)'; } //collabrations $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); @@ -646,7 +647,7 @@ class TicketController extends Controller $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; } } else { - $string = "(no subject)"; + $string = '(no subject)'; } //collabrations $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); @@ -1036,8 +1037,6 @@ class TicketController extends Controller * @param type $emailadd * @param type $username * @param type $subject - * - @param type $body * @param type $phone * @param type $helptopic * @param type $sla @@ -1921,7 +1920,7 @@ class TicketController extends Controller $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; } } else { - $string = "(no subject)"; + $string = '(no subject)'; } //collabrations $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); @@ -2033,7 +2032,7 @@ class TicketController extends Controller $string = substr($stringCut, 0, strrpos($stringCut, ' ')).' ...'; } } else { - $string = "(no subject)"; + $string = '(no subject)'; } //collabrations $collaborators = DB::table('ticket_collaborator')->where('ticket_id', '=', $ticket->id)->get(); diff --git a/app/Http/Controllers/Installer/helpdesk/InstallController.php b/app/Http/Controllers/Installer/helpdesk/InstallController.php index e5c1e63bf..bfd12034b 100644 --- a/app/Http/Controllers/Installer/helpdesk/InstallController.php +++ b/app/Http/Controllers/Installer/helpdesk/InstallController.php @@ -281,13 +281,11 @@ class InstallController extends Controller // checking is the installation was done previously try { $check_for_pre_installation = System::all(); - if($check_for_pre_installation) { + if ($check_for_pre_installation) { return redirect()->back()->with('fails', 'The data in database already exist. Please provide fresh database'); - } + } } catch (Exception $e) { - } - // migrate database Artisan::call('migrate', ['--force' => true]); diff --git a/config/app.php b/config/app.php index 624127e71..ba6ec779d 100644 --- a/config/app.php +++ b/config/app.php @@ -143,80 +143,6 @@ return [ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* * Laravel Framework Service Providers... */ @@ -319,7 +245,7 @@ return [ 'SMTPS' => 'App\Http\Controllers\HomeController', 'Datatable' => 'Chumper\Datatable\Facades\DatatableFacade', 'Zipper' => 'Chumper\Zipper\Zipper', - 'Image' => Intervention\Image\Facades\Image::class, + 'Image' => Intervention\Image\Facades\Image::class, 'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth', 'JWTFactory' => 'Tymon\JWTAuth\Facades\JWTFactory',