Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to generate content for model classes from sub-folders of Models directory #64

Open
KonstantinLapkovsky opened this issue Dec 14, 2023 · 1 comment
Milestone

Comments

@KonstantinLapkovsky
Copy link

KonstantinLapkovsky commented Dec 14, 2023

Implement this logic only after covering the current generators with tests in #49

In some cases, we have model classes inside Model directory subfolders

Models
├── Forum
│   ├── Topic
│   │   ├── Media.php
│   │   └── Thread.php
│   |── User.php
|   └── Post.php
├── Media.php
└── User.php

We should be able to generate content for /Media.php model as well as for /Forum/Topic/Media.php.

To generate content for a model inside a subfolder we should prefix a model name with a folder name separated by the slash /. For sample, Forum/Topic/Media.

When we create a new model we should create its parent folders if they do not exist. For example, the console command php artisan make:entity Forum/Notification/Message creates the next structure

Models
├── Forum
│   ├── Notification
│   │   └── Message.php
│   ├── Topic
│   │   ├── Media.php
│   │   └── Thread.php
│   |── User.php
|   └── Post.php
├── Media.php
└── User.php

The console command php artisan make:entity Forum/Topic/Thread --only-nova-resource should create Nova's resource class for Thread model inside Models/Forum/Topic folder.

If a model does not exist we should receive an error message.

@DenTray
Copy link
Collaborator

DenTray commented Jan 17, 2024

@KonstantinLapkovsky thanks! I believe it would be great to implement it in the next release.

@DenTray DenTray removed their assignment Jan 17, 2024
@DenTray DenTray added this to the 2.2 milestone Jan 17, 2024
@DenTray DenTray modified the milestones: 3.2, 3.3 Nov 27, 2024
@DenTray DenTray modified the milestones: 3.3, 3.4 Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants