0

I am facing an error when sharing data with views:

ErrorException in d280994c1185d651d47347db1597d7ed line 67:
Undefined variable: QandA (View: E:\Web\xampp\htdocs\wifaq-atropos\resources\views\_partials\_footer.blade.php) (View: E:\Web\xampp\htdocs\wifaq-atropos\resources\views\_partials\_footer.blade.php)

This is my code for class AppServiceProvider:

public
function boot() {
  View::composer('_partials._footer', function($view) {
    $QandA = \DB::table('qa') - > take(3) - > orderBy('id', 'desc') - > get();
    $view - > with('QandA', $QandA);
  });
}

This is my_footer.blade.php file:

@foreach($QandA as $QandA)
<div class="post-item">
  <small>JANUARY 2, 2014 BY ADMIN</small>
  <h3><a href="blog-single-sidebar-left.html">{{ $QandA->q }}</a></h3>
</div>
@endforeach

How can I fix this error? Also, when I discuss conversation on laracast, the button always remains disabled. Why? See in link

jvdhooft
  • 657
  • 1
  • 12
  • 33
SAJ
  • 9
  • 4

0 Answers0