samedi 3 août 2019

How to send dynamic variable to partials page "sidebar"?

I have a partial page "sidebar" that shows up in every page. There my logo is dynamic. To display my logo i have send variable through my dashboard controller but it says undefined variable. The problem seems to be in route because "/dashboard" is being called not the "sidebar" For sidebar i have wrote its part in dashboard controller So, how can i make this work?

"Undefined variable: logos (View: C:\xampp\htdocs\odan\resources\views\admin\partials\sidebar\sidebar.blade.php) (View: C:\xampp\htdocs\odan\resources\views\admin\partials\sidebar\sidebar.blade.php) (View: C:\xampp\htdocs\odan\resources\views\admin\partials\sidebar\sidebar.blade.php)"

Dashboard controller
public function sidebar()
    {
            $data['logos'] = Setting::first();

            return view('admin.layouts.app',$data);
    }```

Sidebar.blade.php
``` <!-- Brand Logo -->
    <a href="index3.html" class="brand-link">
      <img src="" alt="Odan Logo" class="brand-image img-circle elevation-3" style="opacity:.8">
      <span class="brand-text font-weight-light">Odan</span>
    </a>```

app.blade.php
```<body class="hold-transition sidebar-mini layout-fixed">
<div class="wrapper">
  @include('admin.partials.navigation.navbar')
  @include('admin.partials.sidebar.sidebar')
  @yield('content')
  @include('admin.partials.footer.footbar')
</div>```



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire