Laravel 10 - How to Name Things

May 01, 2023 · Article · 1 min, 258 words

Hello Artisans, today I'll not show you any tutorials or project related problem. Today I'll give you some tips which will be required for all the time whenever you worked with Laravel. So, no more talks let's move to the topics.

So our today's topic is how we should always name things for Model, migration etc. Just a reminder that, name things is not mandatory but be mind that using name which is recommended by laravel itself is always referred to standard one. And if you always use standard way for coding then you'll benefitted as 

  1. You don't need to write extra code for configure things 
  2. New developers need less time to understand your code
  3. Less time leads to manage your time properly
  4. If you doesn't use standard way then some developers may think as a bug

So let's see what we should keep in mind for using laravel standard way,

For creating Model, we should always use singular form like “Book” instead of "Books". And we should also use English words rather that any other  language. Because when we use the command php artisan make:model Book then It always search for the books table in database.

That's a small tip for today. I hope you always use the standard way which is recommend by Laravel Official Docs. Thanks for reading. 🙂



No comments yet…