imanghafoori1/laravel-widgetize

Cannot end a section without first starting one

dionajie opened this issue · 4 comments

I'm using widgetize for the first time for laravel 5.6. When i put widget in blade template, error happened. It says "Cannot end a section without first starting one". Why?

Nvm. Im using different variable to refers data. i just have to init $contextAs. Btw, great package!
Thanks!

@dionajie If you explain the situation better maybe we can provide a better error message for that,

Hi, I have the same error, when using a nested widgets like this:

// /Widgets/toursView.blade.php
  @foreach($data as $tour)
        <div class="col-sm-4 my-3">
            @widget('Tour\Partial\Item', ['tour' => $tour])
        </div>
    @endforeach

changing the $contextAs doesn't resolve my issue! mybe there are an issue when embeding widget inside other widget loop!

Sorry , I found the issue : )
in the widget class am retournin an array of object instead of the object itself

public function data($tour)
{
   return [$tour];
}

changed to :

public function data($tour)
{
    return $tour;
}

Its not an issue related to the package!
Great work, thank you.