5 years ago

how does laravel know?!

Posted 5 years ago by krie9er


i've made some startexercieses and they were pretty cool.

But i still have one question:

how does laravel match a model to the equivalent of the database?

So in my lessons i had a table "articles" and a model called article, with which i could use the "articles" table.

But how does laravel identify this model?

For example if i have a table called "works" and i try to use the model "exams" how can i tell laravel which model it has to use?

A concrete example: I have a table currencies, which has an 1:n relation to for example orders.

So my model is called currency and the table is called currencies.

I moved from th doctrine project to laravel, in doctrine i could define the table and class in the *.yaml.

Is there any equivalent method in laravel?

Greetings Georg

Please sign in or create an account to participate in this conversation.