Nice
Widgets for Laravel
For those of you who find using View Composer in some situations not readable enought I've build a small and nice (in my opinion) package providing widget functionality.
https://github.com/arrilot/laravel-widgets
UPD. Added lots of cool staff, feel free to try
thanks for the package.
one thing what i dont really understand is how to bind a variable to the widget ? Or is the way i write this only ( for example ):
public function run()
{
$news = News::get();
return $news;
}
You can also create class properties in your widget class. Next, if you want, they can be set/overriden by the config array when the widget is called. Example can be found in the end of github readme.
nice package. (y)
very good package
I've just updated the package to 2.1. Now it also provides asynchronous widgets https://github.com/Arrilot/laravel-widgets#asynchronous-widgets , some extra configuration etc.
L5 is supported ofc.
Nice package
Good job :) very useful.
Cool stuff :D
I think I must be missing something very obvious but I'm trying to use your package and I can't get it to be recognized in a view - have you got an example to show how to use a widget in a view?
@AndrewPrentis : just call the facade from the view, it's in the docs :
{!! Widget::recentNews() !!}
Will call the RecentNews widget class.
Nice package BTW ! I really like this approach and the witty use of Laravel's Facades.
@Arrilot : Is it possible to have Widgets in several different namespaces ?
That doesn't work for me - the view just prints {!! Widget::recentNews() !!} to the web page, so I have obviously missed something somewhere...
@AndrewPrentis Did you use blade?
@RemiC Yes, but you have to manually add each widget that is not from the default namespace to the package config.
@AndrewPrentis if you happen to use L4 use old blade syntax {{ }}
Nice package.
how do i call this widget from WYSIWYG editor???
What a lovely package! Excellent!
Great package. However I am running in an issue here. I can't seem to use the widgets with VueJS. As vue doesn't allows script tags in the app. Is there any workaround this?
Great Package! Having fun using it! Running into a problem, when I deploy to server, it does not found the "classes" that widget create! What am I doing wrong?
/vendor/arrilot/laravel-widgets/src/Factories/AbstractWidgetFactory.php
if (!class_exists($widgetClass)) { throw new InvalidWidgetClassException('Class "'.$widgetClass.'" does not exist'); }
Hi @amaro do you tried composer dump-autoload -o after deployment?
Very interesting package, but I can't get the asynchronous call to the recentNews page to work, could you provide me with a working example?
Thanks and good job
i am working with this package , how can i reload widget async widgets by js or jquey
function updateDashboard() { let widgets = @json($widgets) ; const formData = { _token: "{{ csrf_token() }}", region: $('#region').val(), year: $('#year').val(), month: $('#month').val(), start_at: start_at, end_at: end_at, team_id:$('#team_id').val() , assigned_to: $('#user_id').val(), // limit: $('#limit').val() ,
// pinsStatus: $('#pinsStatus').val()
};
$('#arrilot-widget-container-1').html('{{@asyncWidget('App\Widgets\PinCountWidget', ['filters'=>$filters,'pinStatuses'=>$pinStatuses,'teams'=>$teams])}}') ;
}
Please or to participate in this conversation.