imanghafoori1/laravel-widgetize

Laravel 6.1 compatibility issue

it-saeed opened this issue · 5 comments

سلام آقای غفوری
پکیج رو روی لاراول ورژن ۶ نصب کردم
به ویجت با اسم فوتر ساختم
داخل قالب این رو اضافه کردم و ارور زیر رو میگیرم
@widget('footer')
https://flareapp.io/share/B5Z9vN7o

Hi, thanks for report
please provide a better explanation of the situation.
Specially the content for the footer widget, you.

@imanghafoori1
footerView.blade.php

{{--
Here you will have access to :



1 - "$data" (data from controller) and
2 - "$params" (data passed to @widget('name', $params) call).

try : {!! dd($data, $params) !!} to see what you have.
--}}

<div>test</div>

footer.php

<?php

namespace App\Widgets;


/**
 *  |--------------------------------------------------------------------------
 *  |   You can use the below snippets to override the defaults.
 *  |====== Remove this doc block if you don't need it ========
 *  |--------------------------------------------------------------------------
 *  | public $contextAs = '$data'; (default : '$data')
 *  | public $controller = '\App\ClassPath\ُSomeClass@someMethod'; (optional)
 *  | public $presenter = \App\ClassPath\WidgetPresenter::class; (optional)
 *  | public $minifyOutput = true; (use it to override the default value in config file)
 *  | public $cacheTags = []; (optional) (Available for all cache driver)
 *  | public $cacheLifeTime = 0;   (use it to override the default value in config file)
 *  | public $cacheView = false; You may only cache the controller result. (default : true)
 *  | public $template; (optional) (By default it looks for the view file generated by artisan)
 *  |--------------------------------------------------------------------------
 */
class footer
{


    /**
     * You may call this widget in any blade files like this :
     * @widget('footer', ['a' => 'someVal', 'b' => 'foo'])
     */
    public function data($a, $b)
    {
        return [];
    }

    /**
     * If the widget output depends on query strings you should return key names.
     * otherwise you get undesired results out of the cache store. for example:
     * example.com/product?page=1 and you use the page number in your db query
     * or if you want it to be separated for each user: return auth()->id();
     */
    public function extraCacheKeyDependency($args)
    {
        return [/* request('page') */];
    }
}

footer.blade.php

@widget('footer')

اسم فایل هم تغییر دادم و هیچ تاثیری نداشت

delete the extra comments:

footerView.blade.php

<div>test</div>
public function data()
{
        return [];
}

also change the data method. (delete $a and $b)

try out the 1.9.25 version

@imanghafoori1
ممنون . مشکل برطرف شد