What are modules in Laravel

312 Views Asked by At

I'm learning Laravel and I'm quite familiar with Laravel stuff but I've seen a question about Laravel Modules on this website and the user said that he has made a User module and a Profile module.

And he also added this as User migration:

Schema::connection(config('modules.connections.user_database'))->create('users', function (Blueprint $table) {
            $table->id();
            ...
        });

So the migration seems to be connected to modules.connection.user_database.

Now I wonder what are Modules are ? Does anyone know an article or documentation about Modules ?

I've searched Modules in Laravel official website but there wasn't any result about this.

I would really appreciate if you describe Modules or give me a link for reading more about it...

3

There are 3 best solutions below

0
On

There is really not much to say from this little amount of information, but I believe the creator is managing multiple databases, from multiple connections, one might be in RDS other DynamoDB or local. Maybe one for firestore. But he is creating a decentralized database and breaking them into modules, so rds has User Module to contain User Data where DynamoDb has Profile data. Config has the credentials and creator is switching database as per module.

0
On

Check here for laravel-modules https://nwidart.com/laravel-modules/v6/introduction

config('modules.connections.user_database')

in this code, getting configuration value from /config/modules.php file.

check here for configurations in laravel https://laravel.com/docs/8.x/configuration#accessing-configuration-values

0
On

There is no module in the Laravel world.
In Laravel you will find packages. Everything is managed through composer.
It is a common recurrent question/analogy for people coming from the Symfony framework.