caffeinated / widgets Goto Github PK
View Code? Open in Web Editor NEW:gem: Laravel 5 widgets package
License: MIT License
:gem: Laravel 5 widgets package
License: MIT License
@kaidesu
Support Laravel 5.2 ?
@kaidesu I got the error Class widgets does not exist
I used your example service provider in wiki
https://github.com/caffeinated/widgets/wiki/Registering-Namespaces
What's wrong here ?
I'd like to write a readme for this, is that okay with you?
Anything I should watch for?
Hi, I have a problem passing an array from one widget to another widget.
// @filename Widgets/PostUsers.php
namespace App\Widgets;
use App\Repositories\Contracts\IPostUser;
use App\Repositories\Transformer\Fractal;
use App\Repositories\Transformer\PostUserTransformer;
use Caffeinated\Widgets\Widget;
use Auth;
class PostUser extends Widget
{
protected $instance;
protected $postId;
protected $fractal;
public function __construct(IPostUser $IPostUser, $postId = null) {
$this->instance = $IPostUser;
$this->fractal = new Fractal();
$this->postId = $postId;
}
public function handle() {
$data = $this->instance->findById($this->postId);
$data = $this->fractal->item($data, new PostUserTransformer());
return view('widgets.PostUser', ['post' => $data])->render();
}
}
// @filename view/widgets/PostUser.blade.php (simplified)
<div>
<div>Tag</div>
@if (count($post['tags']))
{!! Widget::ShowTags(['route' => 'one.route', 'tags' => $post['tags']] !!}
@endif
</div>
// @filename Widgets/ShowTags.php
namespace App\Widgets;
use Caffeinated\Widgets\Widget;
use Auth;
class ShowTags extends Widget
{
protected $tags;
protected $route;
public function __construct($route = null, $tags = null) {
$this->tags =$tags;
$this->route = $route;
}
public function handle() {
return view('widgets.ShowTags', ['tags' => $this->tags, 'route' => $this->route])->render();
}
}
in this mode
$this->tags == null and not array
but if I write
// @filename view/widgets/PostUser.blade.php (simplified)
<div>
<div>Tag</div>
@if (count($post['tags']))
{!! Widget::ShowTags(['route' => 'one.route', 'tags' => json_encode($post['tags'])] !!}
@endif
</div>
// @filename Widgets/ShowTags.php
namespace App\Widgets;
use Caffeinated\Widgets\Widget;
use Auth;
class ShowTags extends Widget
{
protected $tags;
protected $route;
public function __construct($route = null, $tags = null) {
$this->tags =$tags;
$this->route = $route;
}
public function handle() {
return view('widgets.ShowTags', ['tags' => json_decode($this->tags, true), 'route' => $this->route])->render();
}
}
then all is OK
$this->tags == array(object)
with all my correct values.
I don't know why?
Sorry for my bad english.
Hello!
Using three modules:
caffeinated/themes
caffeinated/modules
caffeinated/widgets
Problem with output templates, the code can not find the template in the folder
\app\Modules\Catalog\Resources\Views\widgets
public function handle()
{
return Theme::view('widgets.menu');
}
Need Support L5.3 and L5.4 please
Hi,
I noticed that several of your packages have gone deprecated. Are you planning to stay with widgets or are you coming up with some new packages?
Is this widget package going to get some 53 love too?
When i do register in Service provider
<?php
namespace SOV\Providers;
use Widget;
use Illuminate\Support\ServiceProvider;
class WidgetServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
Widget::register('SOV\\Widgets');
}
}
i keep getting error - Class widgets does not exist
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.