vendredi 27 décembre 2019

Access variable across methods Laravel PHP

Hey all actually I too facing the problem but I couldn't understand any of the above methods. Please help me to understand those stuffs and help t fix my problem.

I have two methods method1 and method2, where I receive some value in method 1 which needs to used in method 2. I created a variable on class level but I couldn't access the variable below is the code snippet.

class testController extends controller { 
        public $isChecked = false;
        public $isSelectedValue = 0;
public function ValidateValue(Request $req) {
        $isChecked = $req->checked;
        $isSelectedValue = $req->value;
     }
public function UsethoseValues() {
        if($isChecked) { // I can't use the variable here it throws run time error. I need help on this please help.
           }
     }
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire