orphail / laravel-ddd Goto Github PK
View Code? Open in Web Editor NEWYet another Laravel 10 DDD interpretation
Yet another Laravel 10 DDD interpretation
As far as I understood the docs there is no place (yet) where I can but logic that is needed by both. E.g. I have a rule that a user can add post on specific conditions. This is relevant for the command. But I also have a button to add a post. I want this button to be shown only when the user is allowed to do so.
Where can I put these shared rules? What is your recommendation?
Thank you in advance.
The test for the automatic creation of database didn't complete successfully.
Tests: 4 failed, 42 passed (221 assertions)
Theses failed tests are as follows:
FAIL Tests\Feature\CompanyTest
⨯ can add a department to a company
⨯ can update a department from a company
⨯ can delete a department from a company
FAIL Tests\Feature\UserTest
⨯ admin can create a user
(1) composer install
(2) cp .env.example .env
(3) php artisan key:generate
(4) php artisan jwt:secret
(5) php artisan test
I was expecting to see the following tables ( in my mysql database) populated:
companies
company_addresses
company_contacts
company_departments
password_reset_tokens
personal_access_tokens
users
What is suppose to happen after a successful completion of the test?
Why don't you have a views folder with a blade template to show any data to user?
I have been trying to populate the DB tables with data.
Upon global search in my VS Code I found out you have a setting seeder class Database\Seeders\DatabaseSeeder.
This class seems to add default configuration to a User database table via the model \App\Models\User.
The namespace \App\Models, however, does not exist . In your README file you explained why you purposefully avoided using the app/ folder ( as is usually the case in Laravel project setting) in order to stress the DDD methodology and hence make a difference to laravel's principle. Instead you mentioned to have opted for the src/ folder. Hence, it makes sense to me why the namespace \App\Models is used nowhere in the laravel-ddd project.
So then the question remain: how to you populate the tables.
Do I use the following namespaces to populate the DB tables ?
(1) Src\Agenda\User\Infrastructure\EloquentModels
(2) Src\Agenda\Company\Infrastructure\EloquentModels
Also what about the following namespace:
(1) Src\Auth\Application\Infrastructure
It doesn't have any EloquentModels. Is it because the class Src\Auth\Application\JWTAuth (which implements the interface Src\Auth\Domain\AuthInterface) depends on the email credential of the class
Src\Agenda\User\Infrastructure\EloquentModels\UserEloquentModel to return a token which in turn is consumed by the Src\Auth\Presentation\HTTP\AuthController to respond with that token ?
If so then what do I do with that token ? Do I use that token for the internal api routing? Or do I pass that token on to a frontend framework of my preference in order for that framework to gain access to the data availble in the laravel-ddd project ?
Inside the class Database\Seeders\DatabaseSeeder I want to invoke the method call() multiple times for each seeder class like for example :
$this->call(UserSeeder::class);
That way I can run all listed seeder classes at once with the command: $php artisan db:seed
This way of listing the seeder classes will require me to create those seeder classes in the first place.
Should I proceed on creating a seeder for each of the Models in the project?
Last question, in class Database\Factories\UserFactory you have commented out the following:
\Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
what has that got to do with the class UserFactory? Here again you mention the namespace \App\Models\User.
In my search, I came across this repository, which offers excellent DDD interpretation and a solid starting point.
However, I discovered that in some Repositories
classes, the upsertAll
method could involve variables that are not defined.
For instance, in the code below, addressEloquent
will be undefined if the company does not possess any addresses, which will prevent the execution of any further code.
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.