mercredi 21 octobre 2015

can I access private variable in method in same class?

I have this controller

class PageController extends Controller
{

    private $myid;

    public funciton index(){
     }

   public function viewbyid($id){
      $this->myid = $id;
     return view('someview');
   }

   public function getRecord(){
        $id = $this->myid;
         echo $id; //it would be null here,if I am going to access this method.
        return view('anotherview');
   }


}

Thank you in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire