samedi 30 janvier 2016

view composer laravel 5.0

I am error facing to 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)

And here is my code 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);
  });
}

Here _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 to fix it ? And other problem when I dicuss conversation on laracast. Its not work button always remain disable. Why? See in link



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

Aucun commentaire:

Enregistrer un commentaire