Q
Q
qjimwomz2018-09-23 11:33:11
Laravel
qjimwomz, 2018-09-23 11:33:11

What is the name of the model in this case?

How to name Eloquent model for pricing details? For example, there is some kind of product (Product model), the product has its own pricing details. What is the correct name - PriceDetail or PriceDetails ? It’s just that usually models in Laravel are called in the singular
PriceDetails sounds good, but if you translate PriceDetail into Russian, you get a “price detail”, somehow not very good, right? I understand, the question is childish, but I want to polish the code.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Victor, 2018-09-23
@v_decadence

The model uses a single number

B
bkosun, 2018-09-23
@bkosun

For example, in English the words "news" and "news" are denoted by one news. News is always singular. Therefore, the "News" model.
That is, you can safely name the model as PriceDetails, or choose a synonym.
PS Community naming conventions:
https://github.com/alexeymezenin/laravel-best-prac...

A
Alex Wells, 2018-09-26
@Alex_Wells

Depends on whether there is one detail or many. For example, if PriceDetail has key-value pairs, then it is a single number, but if it is a set of hardcoded parameters and a one-to-one relationship, then PriceDetails is more logical.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question