php - How to use one variable in more function in one controller in laravel 4 -


i have controller has functions , want use 1 variable through them

class trainercontroller extends \basecontroller {   public function one(){     $variable = "some data";   }    public function two()   {     //how use $variable here ?!   } } 

i tried use session session scope in 1 function (view) in advance

make property

class trainercontroller extends \basecontroller  {    private $variable;    public functionone(){     $this->variable = "some data";   }    public functiontwo()   {     echo $this->variable; //outputs 'some data' if 1st method has been called   } } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -