10 months ago

Global variable return null in laravel 5.7

Posted 10 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.