Code Monkey home page Code Monkey logo

widgets's Introduction

This package has been abandoned and is no longer maintained.

Caffeinated Widgets

Laravel 5.1 Laravel 5.2 Source License

Easily create reusable widget components to be used throughout your Laravel application. Widgets are very similar to Laravel's view composers, but in more of a dedicated sense.

The package follows the FIG standards PSR-1, PSR-2, and PSR-4 to ensure a high level of interoperability between shared PHP code. At the moment the package is not unit tested, but is planned to be covered later down the road.

Documentation

You will find user friendly and updated documentation in the wiki here: Caffeinated Widgets Wiki

Quick Installation

Begin by installing the package through Composer.

composer require caffeinated/widgets

Once this operation is complete, simply add the service provider class and facade alias to your project's config/app.php file:

Service Provider
Caffeinated\Widgets\WidgetsServiceProvider::class,
Facade
'Widget' => Caffeinated\Widgets\Facades\Widget::class,

And that's it! With your coffee in reach, start building out some awesome widgets!

widgets's People

Contributors

kaidesu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

widgets's Issues

roadmap for widgets (plugins)

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?

Class widgets does not exist

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

Is Compatible with caffeinated/modules?

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');

    }

Passing array parameters

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.

Documentation

I'd like to write a readme for this, is that okay with you?
Anything I should watch for?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.