GitHub Rules
Pull request rules ( do not close your task without doing the below points )
- On each task you must create a new branch, branch name must be the Exact name of your task Example "sm-022-adding-students".
- Pull request description
- Please include a summary of the change or which issue is fixed.
- Mark what type of changes you have done, you will find a form to fill once you create the pull request
- add the pull request to your task
- check and resolve if there is any conflict.
- each task you are handling must be in a separate branch.
- if the task moved to bugs and fixes check the comments and must be resolved.
- Must add commands (npm, composer or artisan) that needs to be run after code deployment on the server. must add it in the PR description and Your Task on CRM
- Check what you are going to push to your branch before pushing never push useless and garbage data.
NOTE
Pull requests title must contain the task name and developer name Example ( SM069 David V )
Multi-Language Rule
all the static strings must be written in {{__("static string")}}
for multilanguage
Coding Rules:
General:
- Never do any work in main branch
- Always create a branch for your task
- Branch names must be related to your task
- Always Check git status before commiting your changes.
- Your commits must be descriptive.
Front end rules:
- For Blade Must use livewire
- try to avoid vanila js
- try to create component for common elements
- include common js and css files in layout file
- for inline js or on demand scripts use
@push('below_script') //scripts @endpus
- for inline css or on demand style sheets use
@push('above-style') // styles @endpush
- Try to avoid local assets and always use cloud assets we our assets paths live logos and images are defined in
App/Helpers/Interfaces/Paths
You can add Your. Ask Manager to upload your assets to cloud and give you link - for links and navigation always use Route Method and call route by name. dont use direct links like
url().'/route' or ./route
Back end Rules:
- Always use route model binding where possible
- Always group related routes
- Always use Middleware for inspecting and filtering HTTP requests
- Always create named routes.try to use prefix for groped routed i.e
//This is an exmple how you must define the groued routes Route::name('elite.')->prefix('elite')->group(function () { Route::controller(EliteUniversityController::class)->group(function () { Route::get("", 'show')->name('show'); Route::post("", 'import')->name('import'); Route::post("create", 'create')->name('create'); Route::post("update/{elite_university}", 'update')->name('update'); Route::delete("delete/{elite_university}", 'delete')->name('delete'); }); Route::name('packages.')->prefix('packages') ->controller(ElitePackageController::class)->group(function () { Route::get("", 'show')->name('show'); Route::get("list", 'list')->name('list'); Route::post("create", 'create')->name('create'); Route::post("update/{package}", 'update')->name('update'); Route::delete("delete/{package}", 'delete')->name('delete'); }); });
- Always create
FormValidation
Request for validation - For mass assignment always use validated data i.e
...->create($request->validated())
- Always check the file types and input type in validation
- You must avoid the N+1 query problem. Read Here
- Relation counts must always be loaded in Eager loading read more about it here
- Simple records counts also be done on query. i.e Model::count() not count(Model::get()) read more about it here
- Always use well descriptive CONSTANTS for raw value like,
status = 1 or where('status',0)
. - Always Define Contents in App/Helpers/Interface/.../ and implement on app/Helpers/AppContents class
- for model always add fillables
- always cast your attributes that need to change. like json to array, 1 or 0 bool, etc
- always append asste_url in model data for related assets. like for logo always append logo_url attribute for full url.
- same above rule for image and other assets
- always create relations
- for longer methods or function try to create Laravel Actions. Action Names Must be descriptive
- Your methods or function arguments must always have type i.e
count(Int i)
orcountWords(string $str)
ordoSomething(mixed $arg)
or use union types for two typedoSomething(?mixed $args,?int args, int|string $args )
- Your methods must always have a return type
- Your method names must be descriptive.
- Never use raw query for insertion. and avoid raw as much as you can for getting data from DB
- Always Use Model to handle database operations
- Always upload profile photos, logos and files to cloud.
- If You create any new Env variables you must add it example.env file
- Env variable must not be accessed directly. always access using config file
Task Communication
- Check your new Next day tasks at once, understand them and if there is anything that you need to clear some points try to add it to the task it self not by slack.
Tabs Rules