mardi 31 décembre 2019

Reassign with new value to global variable Laravel PHP

I have a below kind of snippet in my Laravel project where I'm trying to re-assign value to the global variable $ischecked and $isselectedValue in a method ValidateValue() and I'm trying to access the same variable with the updated values in second method called useThoseValues() but I couldn't get the updated value. Kindly help me on this

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) { // this variable values is not getting updated
    }
  }
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire