Help with database table names and model, resource folder structure
Hello everybody.
Sorry, this is completely off topic, but I need help now. I think there are people here who are good at this. Thank you.
I need to add a blog to my project. What structure will be generally accepted and ideal? The project will not consist only of a blog. There will be various modules for users, blog, video, etc.
Help with names of database tables.
Option 1:
posts
categories
tags
files
comments
Option 2:
posts
post_categories
post_tags
post_files
post_comments
Option 3:
blog_posts
blog_categories
blog_tags
blog_files
blog_comments
Help with model folder structure.
Option 1:
app/Models/Post.php
app/Models/Category.php
app/Models/Tag.php
app/Models/File.php
app/Models/Comment.php
Option 2:
app/Models/Post/Post.php
app/Models/Post/Category.php
app/Models/Post/Tag.php
app/Models/Post/File.php
app/Models/Post/Comment.php
Option 3:
app/Models/Blog/Post.php
app/Models/Blog/Category.php
app/Models/Blog/Tag.php
app/Models/Blog/File.php
app/Models/Blog/Comment.php
Help with resource folder structure.
Option 1:
app/Filament/Resources/PostResource.php
app/Filament/Resources/CategoryResource.php
app/Filament/Resources/TagResource.php
app/Filament/Resources/FileResource.php
app/Filament/Resources/CommentResource.php
Option 2:
app/Filament/Resources/Post/PostResource.php
app/Filament/Resources/Post/CategoryResource.php
app/Filament/Resources/Post/TagResource.php
app/Filament/Resources/Post/FileResource.php
app/Filament/Resources/Post/CommentResource.php
Option 3:
app/Filament/Resources/Blog/PostResource.php
app/Filament/Resources/Blog/CategoryResource.php
app/Filament/Resources/Blog/TagResource.php
app/Filament/Resources/Blog/FileResource.php
app/Filament/Resources/Blog/CommentResource.php
6 Replies
i wouldn't do subfolder .. i think the better approach is to split the domains in modules
GitHub
GitHub - nWidart/laravel-modules: Module Management In Laravel
Module Management In Laravel. Contribute to nWidart/laravel-modules development by creating an account on GitHub.
or in packages
No. This option is not suitable.
then for filament a cluster would be good i think
for the models do it like you do in the exesting project
Even the official demo uses different concepts
https://github.com/filamentphp/demo/tree/main/app/Filament/Clusters
https://github.com/filamentphp/demo/tree/main/app/Filament/Resources
https://github.com/filamentphp/demo/tree/main/app/Models
I see the structure used there:
names of database tables
Option 3:
blog_posts
blog_categories
blog_links
blog_authors
model folder structure
Option 3:
app/Models/Blog/Post.php
app/Models/Blog/Category.php
app/Models/Blog/Link.php
app/Models/Blog/Author.php
resource folder structure
Option 3:
app/Filament/Resources/Blog/PostResource.php
app/Filament/Resources/Blog/CategoryResource.php
app/Filament/Resources/Blog/LinkResource.php
app/Filament/Resources/Blog/AuthorResource.php