Search code examples
laravellaravel-blade

Cant reach variable using include blade templates


So I have this structure in my app.blade.php

If statement check if user have subscription and if no shows sub page else show dashboard enter image description here

I send all required variables to dashboard view like this

enter image description here

But when I'm trying to get variable in before-payment view I cant reach it.

enter image description here

I test it without If statement in Dashboard I can use all variables. So how can I use variables in this situation?


Solution

  • I think its better if u passing to global view via AppServiceProvider ( boot function ).

    Just add :

    $plan = Plan::first();
    view()->share('plan', $plan);