caffeinated / modules Goto Github PK
View Code? Open in Web Editor NEW:package: Modules package for Laravel
Home Page: https://caffeinatedpackages.com
License: MIT License
:package: Modules package for Laravel
Home Page: https://caffeinatedpackages.com
License: MIT License
The following error appears after installation from modules package:
"App\Modules\Users\Providers\UsersServiceProvider
not found"
Reason (I think):
I've change the app name from "app" to "cms". So this produce an error. Please fix this! Thanks.
Sorry for my bad english, I'm from Germany ,)
Forgot the --path
option was removed from the migrate Artisan command, so I'll need to figure out a work around for this.
the app
folder is the default for Laravel, so I think that the modules
folder should be place out of app
folder, it is good and easy to manage for my idea.
Example:
app/
..............
modules/
...........
The option --pretend
doesn't work with the console command for module:migrate
.
php artisan module:migrate blog --pretend
Trying to fire the enable/disable facades but get permission errors.
module:disable Profiles
Works, but
Module::enable($module->name)
errors out.
Error:
file_put_contents(/Users/school/Sites/l5/app/Modules/Profiles//module.json): failed to open stream: Permission denied
I haven't tried changing and reverting permissions from my model/repository yet.
Mybe I miss some things, but when i create a module..nothing is created...even i have message that module was created.....when i list module...nothing is listed...
Hello,
i have created a module, enabled it, put a dd('Test') in the ServiceProvider and did a dump-autoload.
However, it does not seem to load the module. Also the routes are not accessible, so it is surely not loading the module.What am I doing wrong?
Thanks
I created a modules with modules:make
but I defined the path in the config as
I created the config file in config/caffeinated/modules.php
. I looked around in the code and seemed config needed to be there.
This is my config file. The creation worked and the module is created as expected in the defined folder.
<?php
return [
'path' => './components/modules',
'namespace' => 'App\Modules\\'
];
the module was created in the right path but when I do module:list
it says not modules defined
Your application doesn't have any modules.
and the routes.php inside the folder is not being read. the route defined in the default routes.php in the newly created module is not working.
I thought may be the files are not being loaded so I added components/modules
in the autoload in composer.json file but that is not also working.
How can i use enable and disable a module in facades?
Hi,
Doesnt appear to load module config files?
Module
--Config
---config.php
\Config::get('module::config');
thanks
Is there a command to publish the config files for this package (and themes) or do we just copy and paste them?
Arigatou!
A nice enhacement could be to automatically set the default controler namespace for each module.
Then you can call directly Module controller without specify the full namespace
namespace Test\Modules\Blog\Http\Controllers;
class BlogController extends \Test\Http\Controllers\Controller
{
public function index() {
// You can call directly Module controller without specify the
// full namespace \Test\Modules\Blog\Http\Controllers\BlogController@index
return \URL::action('BlogController@index');
}
}
removed
I have this issue in a fresh install..........also with this message it prompt that module was created but don t find it and when i do a list module......they are no module...sorry for my english....
should be add .gitkeep
in empty folder?
can't seem to find a way to autoload/register middleware, other than adding it manually in Kernel.php
Hey,
You created very interesteing way to create L5 modules.The only thing that I don't like is the necessity of keepeing all that modules stuff within the main app structure.
Why can't modules be like regular composer's packages?
Hi,
I want to run following command: php artisan module:make-request Importer CreateCountryRequest
. When doing this the following errors is thrown.
exception 'InvalidArgumentException' with message 'Command "dump-autoload" is not defined.'
Laravel version: 5.0.1
html package added!
composer require caffeinated/modules
[InvalidArgumentException]
Could not find package caffeinated/modules at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability
Hello,
I installed caffeinated and realized that it gives "exception 'ErrorException' with message 'array_multisort(): Argument #3 is expected to be an array or a sort flag' in /Applications/MAMP/htdocs/myproject/vendor/caffeinated/modules/src/Caffeinated/Modules/Modules.php:264" error when i try to use composer update command.
Is it a bug?
Thanks.
I'm getting this message after installing.
ContextErrorException in ModulesHandler.php line 51:
Warning: is_dir() expects parameter 1 to be a valid path, array given
I am (starting) using this package and I find useful so far. But I couldn't figure out how to create a resource controller with artisan into a module.
Can someone have an idea? Thanks
Laravel 5 is Released!
So, could I use this package?
First I created Module "System" then "Administration" and when in any view in any module call action(controllerName@method) I get namespace of first onyl Module System (App\Modules\System\Http\Contrllers)
Is there any way to change that or namspace or ti tis a bug
I thought I saw somewhere in the docs but ... I was wondering how or if it is possible to access per module "assets".
on route:clear
error
PHP Warning: Uncaught exception 'ErrorException' with message 'require(/Kagi/Http/routes.php): failed to open stream: No such file or directory' in /Users/...app/Modules/Kagi/Providers/RouteServiceProvider.php:41
Stack trace:
do you need more info?
Now i use Laravel 4, do you have version for support?
PHP Fatal error: Can't use method return value in write context in /data/www/54mz.cn/web/vendor/caffeinated/modules/src/Caffeinated/Modules/Handlers/ModuleMakeHandler.php on line 171
if ( empty($this->finder->files($folder)) && empty($this->finder->files($folder)) ) {
Hello
With the latest commit of Laravel 5 the following problem occurs:
BadMethodCallException in ServiceProvider.php line 111: Call to undefined method [package]
in ServiceProvider.php line 111
at ServiceProvider->__call('package', array('caffeinated/modules')) in ModulesServiceProvider.php line 24
at ModulesServiceProvider->package('caffeinated/modules') in ModulesServiceProvider.php line 24
at ModulesServiceProvider->register() in Application.php line 360
at Application->register(object(ModulesServiceProvider)) in ProviderRepository.php line 83
at ProviderRepository->load(array('App\Providers\AppServiceProvider', 'App\Providers\EventServiceProvider', 'App\Providers\RouteServiceProvider', 'Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', 'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 'Illuminate\Routing\ControllerServiceProvider', 'Illuminate\Cookie\CookieServiceProvider', 'Illuminate\Database\DatabaseServiceProvider', 'Illuminate\Encryption\EncryptionServiceProvider', 'Illuminate\Filesystem\FilesystemServiceProvider', 'Illuminate\Foundation\Providers\FoundationServiceProvider', 'Illuminate\Hashing\HashServiceProvider', 'Illuminate\Mail\MailServiceProvider', 'Illuminate\Pagination\PaginationServiceProvider', 'Illuminate\Queue\QueueServiceProvider', 'Illuminate\Redis\RedisServiceProvider', 'Illuminate\Auth\Passwords\PasswordResetServiceProvider', 'Illuminate\Session\SessionServiceProvider', 'Illuminate\Translation\TranslationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'Caffeinated\Modules\ModulesServiceProvider')) in Application.php line 336
at Application->registerConfiguredProviders() in RegisterProviders.php line 15
at RegisterProviders->bootstrap(object(Application)) in Application.php line 141
at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\DetectEnvironment', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders')) in Kernel.php line 139
at Kernel->bootstrap() in Kernel.php line 102
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 82
at Kernel->handle(object(Request)) in index.php line 53
This is because there is no method package
in \vendor\caffeinated\modules\src\Caffeinated\Modules\ModulesServiceProvider.php
and there is also not such method in vendor\laravel\framework\src\Illuminate\Support\ServiceProvider.php
What different laravel workbench with module package?
Now I use workbench for multiple projects.
I'd like to launch migrations in proper order (using module.json order property), and i doesn't work. I suggest you should read all migartions from all modules first then you should sort them by name and launch in proper order (not module by module like you're doing now).
I did a fresh installation for this and created a new module with
php artisan module:make blog
like in example
<?php
namespace App\Http\Controllers\Blog;
use App\Http\Controllers\Controller;
class BlogController extends Controller{
function home() {
return "hello";
}
}`
This is my blog controller inside the module
and this is my route file
Route::group(['prefix' => 'blog'], function() {
Route::get('/', function() {
dd('This is the Blog module index page.');
});
get('/home','Blog\BlogController@home');
});`
but when i hit blog/home i get this Blog\BlogController not found error
what am I missing?
am i supposed to include any folder for autoload?
The title probably doesn't make sense so this is what I'm trying to do.
config/general.php
'home_controller' => 'ModuleXYZController@index',
module/Http/routes.php
Route::get('/', Config::get('general.home_controller'));
Basically I'm trying to set up a way to have a module control what the "/" base route is.
However, laravel doesn't want to do this since it's looking for the controller automatically app/Http/Controllers directory.
For now, I just don't have "/" base route in app/Http/ directory.
Module::getProperty('blog::description', 'This is a new description for the blog module.');
probably should be:
Module::setProperty('blog::description', 'This is a new description for the blog module.');
Where docs for using?
Hi,
when I keep the view file in original L5 views directory it works fine
but if I move the module specific views to module's view directory
and use
return view('messenger.index', compact('threads', 'currentUserId'));
it gives me error like:
View [messenger.index] not found.
Am I doing anything wrong here?
The Facade method Module::exists($slug) allways return false
This happens because the method don't search by slug, the method check if module exists using directory basename.
This causes that I have to search modules converting first letter to uppercase
I create a module with slug blog
vagrant@homestead:~/www/laravel5$ php artisan module:make blog
Module [Blog] has been created successfully
When I execute this code:
echo 'shoud return true, returns '.(Module::exists('blog')? 'true': 'false')."\n";
echo 'shoud return false, returns '.(Module::exists('Blog')? 'true': 'false')."\n";
I don't get the expected results:
shoud return true, returns false
shoud return false, returns true
Hi,
What do you suggest in order to have Frontend and Backend Modules? Should I have a common controller, route file, middleware, etc? Maybe separate in diferent modules like blog and blogAdmin?
Thanks
Could you / Are you thinking of adding the ability to let modules have their own composer.json files?
Which would also mean some way to automatically add Service Providers and Aliases to config/app.php or have the module be able to autoload them.
Hi Kai,
I'm wondering if you have an example module?
Domo!
no error message, no log message, no file ...
Looks like a bug
How can i add middleware in the kernel at runtime?
The default RouteServiceProvider generated overrides the root controller namespace of Illuminate\Contracts\Routing\UrlGenerator
Then when Url Generator is invoked,
URL::action('WelcomeController@index');
Exception occurs
FatalErrorException in UrlGenerator.php line 440: Call to a member function domain() on null
1. in UrlGenerator.php line 440
2. at HandleExceptions->fatalExceptionFromError(array('type' => '1', 'message' => 'Call to a member function domain() on null', 'file' => '/home/vagrant/www/laravel5/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php', 'line' => '440')) in HandleExceptions.php line 116
3. at HandleExceptions->handleShutdown()
because UrlGenerator is looking for \App\Modules\Blog\Http\Controllers\WelcomeController@index
After fresh install of Laravel 5 and adding Caffeinated provider and alias to app.php, I have added another package to composer.json and after running composer update there was an error:
vagrant@homestead:~/code/fs$ composer dump-autoload
Generating autoload files
vagrant@homestead:~/code/fs$ php artisan route:list
PHP Fatal error: Class 'Caffeinated\Modules\ModulesServiceProvider' not found in /home/vagrant/code/fs/storage/framework/compiled.php on line 5019
PHP Stack trace:
PHP 1. {main}() /home/vagrant/code/fs/artisan:0
PHP 2. require_once() /home/vagrant/code/fs/artisan:30
PHP 3. require() /home/vagrant/code/fs/bootstrap/start.php:56
PHP 4. Illuminate\Foundation\ProviderRepository->load() /home/vagrant/code/fs/vendor/laravel/framework/src/Illuminate/Foundation/start.php:195
PHP 5. Illuminate\Foundation\ProviderRepository->createProvider() /home/vagrant/code/fs/storage/framework/compiled.php:4988
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Caffeinated\\Modules\\ModulesServiceProvider' not found","file":"\/home\/vagrant\/code\/fs\/storage\/framework\/compiled.php","line":5019}}
I have fixed id by adding below code to autoload section in composer.json
"psr-0": {
"Caffeinated\\": "vendor/caffeinated/modules/src/"
}
Also another bug was in RouteServiceProvider.php in generated module.
Now there should be:
use Illuminate\Routing\RoutingServiceProvider as ServiceProvider;
instead of:
use Illuminate\Routing\RouteServiceProvider as ServiceProvider;
Hi Kai,
I have been worried about Laravel workbenches since Taylor removed them from Laravel 5.0. I was using workbenches for something they were never really intended to be used as; modules. Basically my CMS allows users to create "apps" on the fly, these apps are actually workbenches. Now users can code "apps" in true Laravel, which was the entire point because we all love Laravel. My CMS has a custom URL parser with a Mysql router table, if the route has a "app" tied to it, only then do I actually Add the apps workbench service provide, mod the views path...actually fire up the "app". This allows me to have thousand of workbenches (apps) that are ONLY registered when needed based on the url...very efficient.
Your new modules project looks like a perfect replacement to exactly what I need and I was wondering how it works with thousands of modules. Are all 1000 registered always, or only as needed and can I take control of when they are registered (via URL analysis) instead of your module.json file ??
I was wondering but having a feeling that you can't but anyways,
Is there any to extend a module based on another module?
For example, adding relationships: You start of with a typical user model but then decide to split out the blog functionality into it's own module. But you are left with the issue of adding the relationship back to the blog within the user module.
Hi, I just start using this package and its cool. What I didnt figure out is how to call View in Controller I have folder structure App\Components\System on example and how to call view in controller and is it possible to view layout in Module extend a main laravel view layout master on example and how to do it I dont have any ideas more.
Hello,
I have this fatal errore with a fresh installation.....
Hi,
Is there a way to set the loading order of the modules? Maybe a order option in the module.json file?
Something like this would work:
Modules.php:
public function getByEnabled($enabled = true)
{
$data = [];
$modules = $this->all();
$order = [];
if (count($modules)) {
foreach ($modules as $module) {
if ($enabled === true) {
if ($this->isEnabled($module['slug']))
$data[] = $module;
$order[] = $module['order'];
} else {
if ($this->isDisabled($module['slug']))
$data[] = $module;
}
}
}
array_multisort($order, SORT_ASC, $data);
return $data;
}
module.json:
{
"name": "Pages",
"slug": "pages",
"version": "1.0",
"description": "This is the description for the Pages module.",
"enabled": true,
"order": 0
}
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.