caffeinated / plugins Goto Github PK
View Code? Open in Web Editor NEW:electric_plug: Laravel 5 Plugins
:electric_plug: Laravel 5 Plugins
Hello!
Using modules:
caffeinated/modules
caffeinated/plugins
CatalogServiceProvider.php
<?php
namespace App\Modules\Catalog\Providers;
use App;
use Config;
use Lang;
use View;
use Plugin;
use Illuminate\Support\ServiceProvider;
class CatalogServiceProvider extends ServiceProvider
{
public function register()
{
// This service provider is a convenient place to register your modules
// services in the IoC container. If you wish, you may make additional
// methods or service providers to keep the code more focused and granular.
App::register('App\Modules\Catalog\Providers\RouteServiceProvider');
App::register('App\Modules\Catalog\Providers\WidgetServiceProvider');
Plugin::register('count_ads', 'App\Modules\Catalog\Plugins\CountAds');
$this->registerNamespaces();
}
protected function registerNamespaces()
{
Lang::addNamespace('catalog', realpath(__DIR__.'/../Resources/Lang'));
View::addNamespace('catalog', base_path('resources/views/vendor/catalog'));
View::addNamespace('catalog', realpath(__DIR__.'/../Resources/Views'));
}
}
CountAds.php
<?php
namespace App\Plugins;
class CountAds
{
public function run()
{
return '1111';
}
}
?>
main.blade.php
{{ count_ads() }}
I receive an error when outputting the main template:
FatalErrorException in Plugins.php line 66:
Call to undefined method Illuminate\View\Compilers\BladeCompiler::createMatcher()
I guess this could also be a widget manager.
I was wondering how you'd go about doing a manager to turn on / off plugins (widgets).
With the modules/themes you could do this with the json file but since these packages don't have that what would you suggest?
Thanks!
How is this package different from your widgets package?
lol, l just love how you're one step ahead of what I'm doing! Thanks!
I want to use directories for each plugin under "App\Plugins" (like your modules package). How to make it or do you planning to development your package for it?
Thanks
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.