5
5
5L4VIK2020-11-23 14:17:34
Laravel
5L4VIK, 2020-11-23 14:17:34

Laravel how to make connection?

is it possible to link tables without migrations? I registered a 1-to-many connection, but the error is
https: //cdn.discordapp.com/attachments/47429631752
...
/attachments/47429631752...
https://cdn.discordapp.com/attachments/47429631752...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya S, 2020-11-23
@5L4VIK

Class names are incorrect.
Those. instead app\UserModelof should be App\Models\UserModel.
I recommend using a special constant ::class:
for example $this->belongsTo(UserModel::class, 'idu');
, Naming, of course, gouge your eyes out. Why the word Model in class names? Why do all models have custom id-field names?) Well, these are rather rhetorical questions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question