Applied fixes from StyleCI

This commit is contained in:
vijaysebastian
2016-02-22 04:35:35 -05:00
committed by StyleCI Bot
parent 42291015a7
commit 16ef1dfb2f
2 changed files with 19 additions and 15 deletions

View File

@@ -1039,33 +1039,36 @@ class ApiController extends Controller
}
}
public function getTicketById(){
try{
public function getTicketById()
{
try {
$v = \Validator::make($this->request->all(), [
'id' => 'required|exists:tickets,id'
'id' => 'required|exists:tickets,id',
]);
if ($v->fails()) {
$error = $v->errors();
return response()->json(compact('error'));
}
$id = $this->request->input('id');
if(!$this->model->where('id',$id)->first()){
$error = "There is no Ticket as ticket id: ".$id;
if (!$this->model->where('id', $id)->first()) {
$error = 'There is no Ticket as ticket id: '.$id;
return response()->json(compact('error'));
}
$result = $this->model->where('id',$id)->first();
$result = $this->model->where('id', $id)->first();
return response()->json(compact('result'));
} catch (\Exception $e) {
$error = $e->getMessage();
$line = $e->getLine();
$file = $e->getFile();
return response()->json(compact('error', 'file', 'line'));
}catch (\TokenExpiredException $e) {
} catch (\TokenExpiredException $e) {
$error = $e->getMessage();
return response()->json(compact('error'));
}
}
}

View File

@@ -453,19 +453,20 @@ class TestController extends Controller
}
}
public function getTicketById(){
try{
$url = $this->server . "helpdesk/my-tickets?id=1&api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token=" . \Config::get('app.token');
public function getTicketById()
{
try {
$url = $this->server.'helpdesk/my-tickets?id=1&api_key=9p41T2XFZ34YRZJUNQAdmM7iV0Rr1CjN&token='.\Config::get('app.token');
$_this = new self();
$respose = $_this->callGetApi($url);
return $respose;
} catch (\Exception $e) {
$error = $e->getMessage();
$line = $e->getLine();
$file = $e->getFile();
return response()->json(compact('error', 'file', 'line'));
}
}
}