Applied fixes from StyleCI

This commit is contained in:
Sujit Prasad
2016-02-19 02:20:12 -05:00
committed by StyleCI Bot
parent be5df5334f
commit d637c2b23f
439 changed files with 19063 additions and 19210 deletions

View File

@@ -15,29 +15,32 @@ use DB;
use Exception;
/**
* SlaController
* SlaController.
*
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com>
*/
class SlaController extends Controller {
class SlaController extends Controller
{
/**
* Create a new controller instance.
*
* @return type void
*/
public function __construct() {
public function __construct()
{
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
*
* @param type Sla_plan $sla
*
* @return type Response
*/
public function index(Sla_plan $sla) {
public function index(Sla_plan $sla)
{
try {
/* Declare a Variable $slas to store all Values From Sla_plan Table */
$slas = $sla->get();
@@ -50,9 +53,11 @@ class SlaController extends Controller {
/**
* Show the form for creating a new resource.
*
* @return type Response
*/
public function create() {
public function create()
{
try {
/* Direct to Create Page */
return view('themes.default1.admin.helpdesk.manage.sla.create');
@@ -63,11 +68,14 @@ class SlaController extends Controller {
/**
* Store a newly created resource in storage.
* @param type Sla_plan $sla
*
* @param type Sla_plan $sla
* @param type SlaRequest $request
*
* @return type Response
*/
public function store(Sla_plan $sla, SlaRequest $request) {
public function store(Sla_plan $sla, SlaRequest $request)
{
try {
/* Fill the request values to Sla_plan Table */
/* Check whether function success or not */
@@ -76,21 +84,25 @@ class SlaController extends Controller {
return redirect('sla')->with('success', 'SLA Plan Created Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
return redirect('sla')->with('fails', 'SLA Plan can not Create'.'<li>'.$e->errorInfo[2].'</li>');
}
}
/**
* Show the form for editing the specified resource.
* @param type int $id
*
* @param type int $id
* @param type Sla_plan $sla
*
* @return type Response
*/
public function edit($id, Sla_plan $sla) {
public function edit($id, Sla_plan $sla)
{
try {
/* Direct to edit page along values of perticular field using Id */
$slas = $sla->whereId($id)->first();
$slas->get();
return view('themes.default1.admin.helpdesk.manage.sla.edit', compact('slas'));
} catch (Exception $e) {
return redirect()->back()->with('fails', $e->errorInfo[2]);
@@ -99,12 +111,15 @@ class SlaController extends Controller {
/**
* Update the specified resource in storage.
* @param type int $id
* @param type Sla_plan $sla
*
* @param type int $id
* @param type Sla_plan $sla
* @param type SlaUpdate $request
*
* @return type Response
*/
public function update($id, Sla_plan $sla, SlaUpdate $request) {
public function update($id, Sla_plan $sla, SlaUpdate $request)
{
try {
/* Fill values to selected field using Id except Check box */
$slas = $sla->whereId($id)->first();
@@ -119,17 +134,20 @@ class SlaController extends Controller {
return redirect('sla')->with('success', 'SLA Plan Updated Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Update' . '<li>' . $e->errorInfo[2] . '</li>');
return redirect('sla')->with('fails', 'SLA Plan can not Update'.'<li>'.$e->errorInfo[2].'</li>');
}
}
/**
* Remove the specified resource from storage.
* @param type int $id
*
* @param type int $id
* @param type Sla_plan $sla
*
* @return type Response
*/
public function destroy($id, Sla_plan $sla) {
public function destroy($id, Sla_plan $sla)
{
$default_sla = Ticket::where('id', '=', '1')->first();
if ($default_sla->sla == $id) {
return redirect('departments')->with('fails', 'You cannot delete default department');
@@ -137,49 +155,48 @@ class SlaController extends Controller {
$tickets = DB::table('tickets')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]);
if ($tickets > 0) {
if ($tickets > 1) {
$text_tickets = "Tickets";
$text_tickets = 'Tickets';
} else {
$text_tickets = "Ticket";
$text_tickets = 'Ticket';
}
$ticket = '<li>' . $tickets . ' ' . $text_tickets . ' have been moved to default SLA</li>';
$ticket = '<li>'.$tickets.' '.$text_tickets.' have been moved to default SLA</li>';
} else {
$ticket = "";
$ticket = '';
}
$dept = DB::table('department')->where('sla', '=', $id)->update(['sla' => $default_sla->sla]);
if ($dept > 0) {
if ($dept > 1) {
$text_dept = "Emails";
$text_dept = 'Emails';
} else {
$text_dept = "Email";
$text_dept = 'Email';
}
$dept = '<li>Associated department have been moved to default SLA</li>';
} else {
$dept = "";
$dept = '';
}
$topic = DB::table('help_topic')->where('sla_plan', '=', $id)->update(['sla_plan' => $default_sla->sla]);
if ($topic > 0) {
if ($topic > 1) {
$text_topic = "Emails";
$text_topic = 'Emails';
} else {
$text_topic = "Email";
$text_topic = 'Email';
}
$topic = '<li>Associated Help Topic have been moved to default SLA</li>';
} else {
$topic = "";
$topic = '';
}
$message = $ticket . $dept . $topic;
$message = $ticket.$dept.$topic;
/* Delete a perticular field from the database by delete() using Id */
$slas = $sla->whereId($id)->first();
/* Check whether function success or not */
try {
$slas->delete();
/* redirect to Index page with Success Message */
return redirect('sla')->with('success', 'SLA Plan Deleted Successfully' . $message);
return redirect('sla')->with('success', 'SLA Plan Deleted Successfully'.$message);
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('sla')->with('fails', 'SLA Plan can not Delete' . '<li>' . $e->errorInfo[2] . '</li>');
return redirect('sla')->with('fails', 'SLA Plan can not Delete'.'<li>'.$e->errorInfo[2].'</li>');
}
}
}
}