mercredi 30 janvier 2019

How to make simple if statement bubble style?

How make this if-statement more simple ? , as a function it's working well but i think it's not good on coding.

this is the code :

        if (empty($checkMaxID)) 
        {
            $this->model->insert_temp_code($code_request,$cabang_code);
        }

        $checkHasTempCode = $this->model->checkHasTempCode($user_id);

        if ($checkMaxID['tempcode_created_by'] !=  $user_id ) {
            $data['code_request'] = str_pad($checkMaxID['tempcode_value'] + 1, 5, 0, STR_PAD_LEFT);        

            if (empty($checkHasTempCode) ) {
                $this->model->insert_temp_code($data['code_request'],$cabang_code);
            }
        }
        else
        {
            $data['code_request'] = $code_request;
        }

`

anyone can help me please ?

Thank you

Aucun commentaire:

Enregistrer un commentaire