creolab / laravel-modules Goto Github PK
View Code? Open in Web Editor NEWApplication specific modules in Laravel 4
Application specific modules in Laravel 4
Hello,
Just a message to discuss about adding a module_asset()
helper function.
While publishing module asset is working well, accessing is -i think- very very verbose and not productive.
Something like :
asset('packages/module/my_module/assets/css/style.css')
Could be changed to :
module_asset('my_module', 'css/style.css')
I think we do not have to know how the asset is published, just the asset is available for this module with a simple function.
What do you think about it ?
Does this support tests? If so, can I simply put them into a tests folder inside each module folder?
I was wondering if there is any way to prefix the module name to the routes to maintain uniqueness.
Let say i have modules staff and users and both has the same route called users. In that case the one will override the other one. If we can prefix the module directory name before the route it will become unique by itself
staff/users
users/users
Hi.
I'm trying to get a list of the modules in a view composer, so I can generate a navigation menu of all modules.
In app/filters.php
I put the following code
View::composer('nav', function($view)
{
var_dump($app->modules->modules()->all());
});
but I got an Undefined variable: app
error.
If i put the same code in app/views/layouts/master.blade.php
, it works.
How can I get this data in a view composer?
Thanks!
Hi,
i use following config:
/**
* The path that will contain our modules
* This can also be an array with multiple paths
*/
'path' => array(
'modules',
'portlets'
),
When i publish the assets from the module or portlets folder all will be published inside packages module...
It will bei nicer if the origin folder will be published in public:
Example:
I have a module in "modules/Sample1" . When i publish the assets it should be placed in "public/packages/modules/modules/Sample1" and...
the asstes of the module inside "portlets/Sample2" should be placed in "public/packages/modules/portlets/Sample2"
Bye, René
Hello,
Is it possible to use this package to load multiple modules at the same time?
What i want to achieve is a widget system where the whole app consists of modules.
Example:
This is meant to be a dashboard with different widgets and i want every widget to be a module.
Assci-art-example: http://paste.laravel.com/13jY
//Tim
Was wondering if there is any way of ordering modules. One module in my app is being processed before the other and I'd love to switch that around.
Any idea?
I added a language file in app/modules/test/lang/en/common.php
in my view I use: test::common.hello but that doesn't work.
So, how do we use module translations?
Whenever I use php artisan migrate:reset --pretend
I get a never ending output of Content: drop table
wr_pages`` where wr_pages is just simple a Schema::drop ( 'pages' );
Furthermore, it would be awesome to see something like php artisan modules:migrate --reset
which would not reset the migrations of my normal app.
Finally: thanks for making this package, it makes life quite a lot easier :)!
Can you put everything from the app directory like the database directory with migrations in a module?
Thanks for this module project good idea.
How to use seed with Artisan::call().
Somethink like this:
Artisan::call('modules:seed', array('--module' => 'service'));
Note: I know the normal way
Artisan::call('db:seed', array('--class' => 'App\\Modules\\Service\\Seeds\\DatabaseSeeder'));
It would be nice if dependencies could be defined. Such as: the Messaging
module needs the User
module, perhaps even with a specific version like is being done with composer.json.
Hi,
I am using several modules and for each module a service provider class is defined as described in the documentation.
I have e.g. a module 'Category' and if i reference it inside a view I would like to use the provided Facade name 'Category' but that throws a 'class Category not found'. If i use 'App\Modules\Category\Models\Category' in the view then it works but that's a bit tedious.
If i however add 'App\Modules\Category\ServiceProvider' to the providers array in app/config/app.php then i can as expected just use the class 'Category' inside the view.
But does this mean i have to add the service provider classes for each module to the providers array to be able to use the Facade name? I was under the impression that the service providers for each module would be automatically registered at run time and it would suffice just to add Creolab\LaravelModules\ServiceProvider to the providers array, unless i am mistaking..?
Thanks for your reply.
Any possibility to use it with laravel 4.1.* ?
~/Documents/PhpStorm/AuthPilot(branch:master*) » php artisan
# Command works
~/Documents/PhpStorm/AuthPilot(branch:master*) » php artisan optimize
Generating optimized class loader
~/Documents/PhpStorm/AuthPilot(branch:master*) » php artisan
{
"error":{
"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException",
"message":"Class 'Creolab\\LaravelModules\\ServiceProvider' not found",
"file":"\/Users\/devil\/Documents\/PhpStorm\/AuthPilot\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/ProviderRepository.php",
"line":158
}
}
Being able to use optimize would be extremely helpful as well.
Hi Boris,
is there any chance to extend your package with publishing and reading module config files under ex. "app/config/modules" ? I think it would be very useful in some cases, maybe if you want to update a module without brake its configuration.
I create three modules with routes, but laravel don`t load routes from module.
If set 'mode' => 'manual' on config, seeds not working. But auto mode seeds is work.
Can you please change the permissions from 0755 to 0775 or at least make it a config option.
I'm just update to latest master-dev. Now, i got "No hint path defined for [xyz]" exception.
This exception throw from View::make('xyz::template')
. Thanks
Hi there,
I have been using modules extensively and was wondering if you are planning on a
modules:seed command?
best regards
Is there anyway to make the module includes /add/ to the array rather than overriding it from the default one?
I am suggesting to add interface for module management feature. I am wondering if you will database approach to register modules and enable/disable them via admin panel or you'll use the current structure.
BR
There's a major bug in this package it's to good lol. I see that you have came a long way since I made a suggestion about adding migrations in. Just wanted to say keep up the great work. Thanks.
Hi,
I'm wondering if you're planning on fleshing out the module scaning to recursively scan directories so there can be a bit more folder structure to the modules without having to register each path in the config.
I've tried playing about with it but I'm getting a 404 Exception somewhere between the 2nd and end of modules scanning. None of the routes are getting registered.
I was basically extracting the meat of the Finder->scan() into a loadModules() and then when you check for modules.json, if its false (ie not a module but a folder containing modules) just start diving into the directories.
May play around a bit more when I'm more awake and provide code samples.
What about beautify JSON content of module.json?
It can be more readable and fastest to modify.
My idea is to use JSON_PRETTY_PRINT in json_encode like:
$definition = json_encode(array('enabled' => true), JSON_PRETTY_PRINT);
Or better ... using PHP version check (because this constant is introduced in PHP 5.4) :
$definition = json_encode(array('enabled' => true), (version_compare(PHP_VERSION, '5.4.0', '>=') ? false : JSON_PRETTY_PRINT));
Thoughts?
Hello. I need help!
The package only can load max 8 modules. I do not can add more modules no will be charged.
Strangely not recognize nor the controllers nor methods.
Thank you!
i updated the package using composer, and now my app no load the modules, the console show me this error [2014-07-01 19:47:26] production.ERROR: [MODULES] There was an error when starting modules: [Undefined variable: name] [] []
I had to modify the package to accept a breadcrumbs.php so I can have two with separate templates for admin/public.
// Require module breadcrumbs.php
$breadcrumbs = $this->path('breadcrumbs.php');
if ($this->app['files']->exists($breadcrumbs)) require $breadcrumbs;
Which led me to wonder if custom files per module would be something for the json or some other solution? Maybe it is already possible and I missed it.
The package is https://github.com/davejamesmiller/laravel-breadcrumbs
doesn't create app/modules/lang folder
Hi, is there a way to rollback migration for modules ?
Hi,
any example how to use modules:generate command? and maybe you should update readme.md too :)
Thanks
What if i have the main layout view in app/views/layout/master.blade.php and in the apps/modules/blog/views/ folder i have a view index.blade,php and i want it to extend master.blade.php how would i write that.
I tried @extends('layout.master'), but did not work.
Thank you
module service provider file
$this->app->booting(function()
{
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('MenuCategoryModel', 'App\Modules\Menu\Facades\MenuCategoryModelFacade');
});
module.json file
{
"enabled" : true,
"order" : 1,
"provider": "App\\Modules\\Menu\\ServiceProvider"
}
when switching to auto mode, i can use the facade, but in the manual mode i get a class not found
Hi first of all i really like your package. One thing what i encounterd.
Everything is autoloaded correctly.
I have the following folder structure
routes.php
module.json
And when i load my view
$this->layout->content = View::make('core::users.index')
i get the following error
No hint path defined for [core].
Could you please give me a hint what i am doing wrong?
A quick issue:
If you install the laravel-modules and include the service provider in the app.php and don't create the folder "app/modules", you get an error when trying to do anything with the artisan.
Perhaps it would be best if you could do a check on the directory existance.
Just a suggestion for generate a seed file, I'll fork and make a change then post a pr here.
I have followed the instructions and no matter what I do, all I get is the NotFoundHttpException whoops page.
When I tried copy-pasting your example package into a new install, it worked - but as soon as I tried changing the name of the "content" module to something else (including changing all namespaces, references in routes, module.json files, etc. and performing composer and artisan dumps), I had the same issue.
Is there something I'm missing that is telling Laravel to use "content" as the default module or perhaps something else going on? (I'd be happy to send you my codebase if it would help).
Just a thought, since Way Generators has a generate resource command, would it be easier for when a modules gets created, the generate:resource command is called as well?
I installed the package. The problem is that, My ProductCatalog model can't see my CatalogProductImage model and hence it gives me the following error:
Symfony \ Component \ Debug \ Exception \ FatalErrorException
Class 'CatalogProductImage' not found
I don't know the reason. Here comes the code:
ProductCatalog.php
<?php namespace App\Modules\Product\Models;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
use Eloquent;
use App\Modules\Product\Models\CatalogProductImage as CatalogProductImage;
class ProductCatalog extends Eloquent {
protected $table = 'catalog';
protected $primaryKey = 'catalogId';
protected $connection = 'mysql2';
public $timestamps = FALSE; //update time stamp varsa true yap, updated_at ve created_at alanlarını otomatik gunceller
public function category() {
return $this->hasOne('CatalogCategory', 'catalogCategoryId', 'catalogCategoryId');
}
public function images() {
return $this->hasMany('CatalogProductImage', 'catalogId');
}
}
CatalogProductImage.php
<?php namespace App\Modules\Product\Models;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableInterface;
use Eloquent;
class CatalogProductImage extends Eloquent {
protected $table = 'catalog_image';
protected $primaryKey = 'catalogImageId';
protected $connection = 'mysql2';
public $timestamps = FALSE; //update time stamp varsa true yap, updated_at ve created_at alanlarını otomatik gunceller
public function catalog() {
return $this->hasMany('ProductCatalog', 'catalogId');
}
}
What would be the best way to create unit tests for the modules?
Is it possible to have multiple providers?
I have a problem with the default php artisan migrate:rollback
or php artisan migrate:reset
. Probably same issue with refresh
I get the following when executing it.
PHP Fatal error: Class 'CreateExampleTable' not found in .../vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php on line 29
Seems like a namespace issue. I tried adding a namespace in the top of the migration class file. But no luck.
Anyone having this issue?
Testing with the your sample modules app but none of the routes work for me..
Any idea why I am getting: View not found?
Filestructure:
http://screencloud.net/v/79Vy
Hey, mate.
Me again.
So, I am doing a CMS which has multiple instances and I'd love to make my base module central, so in case of any changes it can only be changed in one place and it affects all instances.
The idea I was having was if it is possible to enlist a folder for modules outside of the application folder.
I have tried changing the base_path() to realpath() in the Finder.php (line 98) which actually finds the module outside but seems to break down the loading of the modules (guessing they are loaded with the relative path).
You have any idea how I could achieve that (to load them outside of application) and if you could add it to the package configuration).
Thanks for your reply.
If the module don't exists return an error:
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Call to a member function path() on a non-object","file":"D:
xampp\htdocs\Laravel\vendor\creolab\laravel-modules\src\Creolab\LaravelModules\ModulesPublishCommand.php","line":63}}
To fix: check if the module to publish if exists.
Why don;t you putt into the manual that is posible to create a module from composer?
I was using your examples and got only errors, and i started again, clean instalation, then the modules package and still errors. So i tried this on command line:
php artisan modules:create mymodule
And worked.
BTW great tool here.
Hi.
This is a great package and I use it always ;).
I think it would be good if we could have multiple seeders per module.
If we set array for seeder in module.json for example
{
"enabled": true,
"seeder": [
"Product\\Seeds\\ProductsSeeder",
"Product\\Seeds\\AttributesSeeder"
]
}
There is little modification of Module.php:
public function seed()
{
$classes = $this->def('seeder');
foreach((array)$classes as $class){
if (class_exists($class))
{
$seeder = new $class;
$seeder->run();
}
}
}
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.