Laravel Passing an Object to Other Methods

I use Laravel to create a complex registration form. Now I want to use Company Object throughout the process.

I am currently creating a new Company object in the constructor as follows:

public function __construct()
{
    $this->company = new Company();
}

And then I populate the object with data from the API.

But the object returns null every time I find a new method or route.

I see no other way around this? Any ideas? Thank!

Works

return redirect()->route('register.contacts')->with('company', $company);

And in the contact method

public function contacts()
{

    Session::get('company'));
}
+4
source share
1 answer

, , . , PHP . . , , .

, , . , , URL . . , - URL- ( ) - .

, :

  • . " ",
  • , .
+4

All Articles