Apply fixes from StyleCI

This commit is contained in:
Manish Verma
2016-12-13 13:14:54 +00:00
committed by StyleCI Bot
parent 857d3004eb
commit 88f3df2180
161 changed files with 4729 additions and 3879 deletions

View File

@@ -5,7 +5,6 @@ namespace App\Http\Requests\helpdesk;
use App\Http\Requests\Request;
use App\Model\helpdesk\Settings\CommonSettings;
/**
* CompanyRequest.
*
@@ -30,11 +29,12 @@ class ClientRequest extends Request
*/
public function rules()
{
$check = $this->check(new CommonSettings);
$check = $this->check(new CommonSettings());
if ($check != 0) {
return $check;
$custom_rule = $this->getCustomRule();
$rules = array_merge($check, $custom_rule);
return $rules;
}
$current_rule = [
@@ -45,70 +45,83 @@ class ClientRequest extends Request
];
$custom_rule = $this->getCustomRule();
$rules = array_merge($current_rule, $custom_rule);
return $rules;
}
public function getHelpTopic(){
public function getHelpTopic()
{
$help_topics = new \App\Model\helpdesk\Manage\Help_topic();
$topic = $this->input('helptopic');
$help_topic = $help_topics->where('id',$topic)->first();
$help_topic = $help_topics->where('id', $topic)->first();
return $help_topic;
}
public function getCustomRule(){
$custom_form = "";
public function getCustomRule()
{
$custom_form = '';
$help_topic = $this->getHelpTopic();
if($help_topic){
if ($help_topic) {
$custom_form = $help_topic->custom_form;
}
return $this->getForm($custom_form);
}
public function getForm($formid){
$id = "";
public function getForm($formid)
{
$id = '';
$forms = new \App\Model\helpdesk\Form\Forms();
$form = $forms->where('id',$formid)->first();
if($form){
$form = $forms->where('id', $formid)->first();
if ($form) {
$id = $form->id;
}
return $this->getFields($id);
}
public function getFields($formid){
public function getFields($formid)
{
$rules = [];
$field = new \App\Model\helpdesk\Form\Fields();
$fields = $field->where('forms_id',$formid)->get();
if($fields->count()>0){
foreach($fields as $fd){
if($fd->required==='1'){
$rules[str_replace(" ",'_',$fd->name)]="required";
$fields = $field->where('forms_id', $formid)->get();
if ($fields->count() > 0) {
foreach ($fields as $fd) {
if ($fd->required === '1') {
$rules[str_replace(' ', '_', $fd->name)] = 'required';
}
$rules = array_merge($rules,$this->getChild($fd->id));
$rules = array_merge($rules, $this->getChild($fd->id));
}
}
return $rules;
}
public function getChild($fieldid){
public function getChild($fieldid)
{
$children = new \App\Model\helpdesk\Form\FieldValue();
$childs = $children->where('field_id',$fieldid)->get();
$childs = $children->where('field_id', $fieldid)->get();
$rules = [];
if($childs->count()>0){
foreach($childs as $child){
if ($childs->count() > 0) {
foreach ($childs as $child) {
$child_formid = $child->child_id;
return $this->getForm($child_formid);
}
}
return [];
}
/**
*@category Funcion to set rule if send opt is enabled
*@param Object $settings (instance of Model common settings)
*
*@param object $settings (instance of Model common settings)
*
*@author manish.verma@ladybirdweb.com
*@return array|int
*
*@return array|int
*/
public function check($settings)
{