By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
digital news today : Latest News digital news today : Latest News
Notification Show More
Latest News
OctaneRender 2022.1 review: a confusing release schedule, but faster than ever
creativetrends
Pen Testing Solutions That Challenge the Status Quo
thehackernews
How To Use Performance Max For Travel Campaigns
ahref
The Now Pass Sold Out. Here’s What’s Next.
web3
Options for the Best Trip to Italy
Nomad trip
Aa
  • Marketing
    • Crypto
    • news nft tech frensh
    • Technology
  • ahref
    • android
    • blogdumoderateur
    • creativetrends
    • Crypto
    • css tricks daily
  • Daily sécurité
    • dailydev
  • digitaltrends
    • Featured
    • Food
    • for blogger
    • google
    • gpldload
  • Technology
    • It-Connect
      • Laravel tricks
      • Marketing
      • news nft tech frensh
      • nft
      • thehackernews
      • web3
        • webrankinfo
Reading: How to Name Things in Laravel
Share
digital news today : Latest News digital news today : Latest News
Aa
  • Marketing
  • ahref
  • Daily sécurité
  • digitaltrends
  • Technology
Search
  • Marketing
    • Crypto
    • news nft tech frensh
    • Technology
  • ahref
    • android
    • blogdumoderateur
    • creativetrends
    • Crypto
    • css tricks daily
  • Daily sécurité
    • dailydev
  • digitaltrends
    • Featured
    • Food
    • for blogger
    • google
    • gpldload
  • Technology
    • It-Connect
Follow US
© 2022 Foxiz News Network. Ruby Design Company. All Rights Reserved.
digital news today : Latest News > Laravel tricks > How to Name Things in Laravel
Laravel tricks

How to Name Things in Laravel

Mike
Last updated: 2023/03/18 at 2:58
Mike
Share
SHARE


How should you name your Controllers: singular or plural? With other similar questions, naming things consistently is important for code readability, compliance with standards, and avoiding errors. In this tutorial, we will cover a dozen tips for naming different things in Laravel and PHP, including Models, Controllers, Blade files, Migrations, and more.

Keep in mind that most of those are not strict rules, you can name things however you want, as long as it works. However, the problems with non-standard naming can be these:

  • You may need to write additional code to configure things to work properly
  • New developers on your team may need more time to understand the code
  • If things are named inconsistently, other developers need more brainpower/time to decide how to name things in their code
  • In some cases, it may even lead to bugs

So, I do encourage you to keep your code as close as possible to the standard naming conventions. Here are the examples.


How to Name Models in Laravel?

The rule of thumb in Laravel is to use a singular form for model names, like Book instead of Books.

This is because when you generate a model using php artisan make:model, Laravel assumes that the corresponding database table will be plural.

Using English words for naming is also…



tricks laravel digital news

TAGGED: tricks

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.

By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Mike mars 18, 2023
Share this Article
Facebook Twitter Copy Link Print
Share
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article The TikTok logo: history and inspiration
Next Article Vendeur F/H – CDI – Temps Partiel
lapressecrypto.com
lapressecrypto.com
Follow US

© 2022 Foxiz News Network. Ruby Design Company. All Rights Reserved.

Removed from reading list

Undo
Go to mobile version
Welcome Back!

Sign in to your account

Register Lost your password?