Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Controllers:
- File and Folder Structure:
App/Http/Controllers
/Backend/
AdminController.php
WorkplaceController.php
WorkplaceDeliveryController.php
...
/Frontend/
...
/API/
...
//none or only one level of nesting
//all controller names are in singular (not plural) UserController, not UsersController
//all actions that return a view, should return a rendered view
//return view('someView')->render(); For better info about the error.
Views
- View folder name is same as the controller name. camelCase.
- Backend/UsersController -> /backend/user
- UserController@show -> user/show.blade.php
- partials start with "_"; if @create and @edit use a partial for the form name it _form.blade.php
Routes:
- all routes are in a single file.
- try to namespace/prefix routes only for folder: Route::group(['namespace' => 'Frontend'], function () { ... });
- One group of routes should have a separate controller for it.
/human/
/human/{id}
/...
HumanController
/monster/
/monster/{id}
/...
MonsterController
table: beings
What if controller(s) points to one table but have different views?
- maybe make different controllers for different entities
Images:
- write helpers for image file paths (for autocomplete path to image and no typos)
//path_to_school_image(filename)
- Store image directory paths in config //env('shoes_images_dir');
//'shoes_images_dir'=>'img/shoes/'
Translations names follow the way to the view:
- frontend.schoolsDelivery.index.pageTitle
- backend.workDelviery._form.nameLabel
Tables:
- make only the last word in plural.
- User -> users
- UserProfile -> user_profiles
- UserProfilePicture -> user_profile_pictures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment