jeudi 26 octobre 2017

Laravel 5.5 pass variable to child controller return always null?

I have a main controller CmsController, wich is extended to default laravel controller:

use App\Http\Controllers\Controller;
class CmsController extends Controller
{
    protected $web = null;

    public function __construct(Request $request)
    {
        $this->web = Web::domain($request->domain)->first();
    }
}

Now, in this controller I want to call $this->web

use App\Http\Controllers\Web\PageController;
class PageController extends CmsController
{
    public function getPage(Request $request)
    {
        dd($this->web); // returns always null
    }
}

The data that should be returned is 100% correct, reqest params are also there...

Can someone give me a idea, what I did wrong here?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2y5hXaj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire