Global variable return null in laravel 5.7

Posted 7 months ago by coder_uzb

Hi guys. I am using laravel 5.7 and in my controller.

protected $x;

public function index()
    $this->x = 22;

public function other_index()
    return $this->x;

When I call other_index() function variable x return null. How to fix it?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.