Applied fixes from StyleCI
This commit is contained in:

committed by
StyleCI Bot

parent
be5df5334f
commit
d637c2b23f
@@ -14,25 +14,25 @@ use App\User;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* CannedController
|
||||
* CannedController.
|
||||
*
|
||||
* This controller is for all the functionalities of Canned response for Agents in the Agent Panel
|
||||
*
|
||||
* @package Controllers
|
||||
* @subpackage Controller
|
||||
* @author Ladybird <info@ladybirdweb.com>
|
||||
*/
|
||||
class CannedController extends Controller {
|
||||
|
||||
class CannedController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* constructor to check
|
||||
* 1. authentication
|
||||
* 2. user roles
|
||||
* 3. roles must be agent
|
||||
* 3. roles must be agent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
// checking authentication
|
||||
$this->middleware('auth');
|
||||
// checking if role is agent
|
||||
@@ -41,27 +41,34 @@ class CannedController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the Canned Responses.
|
||||
*
|
||||
* @return type View
|
||||
*/
|
||||
public function index() {
|
||||
public function index()
|
||||
{
|
||||
return view('themes.default1.agent.helpdesk.canned.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new Canned Response
|
||||
* Show the form for creating a new Canned Response.
|
||||
*
|
||||
* @return type View
|
||||
*/
|
||||
public function create() {
|
||||
public function create()
|
||||
{
|
||||
return view('themes.default1.agent.helpdesk.canned.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created Canned Response.
|
||||
* @param type CannedRequest $request
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @param type CannedRequest $request
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function store(CannedRequest $request, Canned $canned) {
|
||||
public function store(CannedRequest $request, Canned $canned)
|
||||
{
|
||||
// fetching all the requested inputs
|
||||
$canned->user_id = \Auth::user()->id;
|
||||
$canned->title = $request->input('title');
|
||||
@@ -69,6 +76,7 @@ class CannedController extends Controller {
|
||||
try {
|
||||
// saving inputs
|
||||
$canned->save();
|
||||
|
||||
return redirect()->route('canned.list')->with('success', 'Added Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]);
|
||||
@@ -77,24 +85,31 @@ class CannedController extends Controller {
|
||||
|
||||
/**
|
||||
* Show the form for editing the Canned Response.
|
||||
* @param type $id
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @return type View
|
||||
*/
|
||||
public function edit($id, Canned $canned) {
|
||||
public function edit($id, Canned $canned)
|
||||
{
|
||||
// fetching requested canned response
|
||||
$canned = $canned->where('user_id', '=', \Auth::user()->id)->where('id', '=', $id)->first();
|
||||
|
||||
return view('themes.default1.agent.helpdesk.canned.edit', compact('canned'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the Canned Response in database.
|
||||
* @param type $id
|
||||
* @param type CannedUpdateRequest $request
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @param type $id
|
||||
* @param type CannedUpdateRequest $request
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function update($id, CannedUpdateRequest $request, Canned $canned) {
|
||||
public function update($id, CannedUpdateRequest $request, Canned $canned)
|
||||
{
|
||||
/* select the field where id = $id(request Id) */
|
||||
$canned = $canned->where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first();
|
||||
// fetching all the requested inputs
|
||||
@@ -104,6 +119,7 @@ class CannedController extends Controller {
|
||||
try {
|
||||
// saving inputs
|
||||
$canned->save();
|
||||
|
||||
return redirect()->route('canned.list')->with('success', 'Updated Successfully');
|
||||
} catch (Exception $e) {
|
||||
return redirect()->route('canned.list')->with('fails', $e->errorInfo[2]);
|
||||
@@ -112,11 +128,14 @@ class CannedController extends Controller {
|
||||
|
||||
/**
|
||||
* Delete the Canned Response from storage.
|
||||
* @param type $id
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @param type $id
|
||||
* @param type Canned $canned
|
||||
*
|
||||
* @return type Redirect
|
||||
*/
|
||||
public function destroy($id, Canned $canned) {
|
||||
public function destroy($id, Canned $canned)
|
||||
{
|
||||
/* select the field where id = $id(request Id) */
|
||||
$canned = $canned->whereId($id)->first();
|
||||
/* delete the selected field */
|
||||
@@ -133,20 +152,22 @@ class CannedController extends Controller {
|
||||
|
||||
/**
|
||||
* Fetch Canned Response in the ticket detail page.
|
||||
* @param type $id
|
||||
*
|
||||
* @param type $id
|
||||
*
|
||||
* @return type json
|
||||
*/
|
||||
public function get_canned($id) {
|
||||
public function get_canned($id)
|
||||
{
|
||||
// checking for the canned response with requested value
|
||||
if ($id != "zzz") {
|
||||
if ($id != 'zzz') {
|
||||
// fetching canned response
|
||||
$canned = Canned::where('id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first();
|
||||
$msg = $canned->message;
|
||||
} else {
|
||||
$msg = "";
|
||||
$msg = '';
|
||||
}
|
||||
// returning the canned response in JSON format
|
||||
return \Response::json($msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user