Creating database tables?

Published 2 months ago by LaybackSpin

Hi! I'm having troubles creating tables using laravel. Thus far I've been creating them manually in MyPHPAdmin but when I want to reference the table in the controller I get errors regarding "use App\nameOfTable". Is this App"nameOfTable" suppose to be generated through an artisan code?

Snapey
Snapey
2 months ago (1,036,815 XP)

You need to create Models that represent the tables.

I suggest some reading or watching Laracasts excellent tutorial videos

jlrdw
jlrdw
2 months ago (251,930 XP)

I get errors regarding "use App\nameOfTable"

Migrations are not required, existing tables are fine. But most use migrations.

But how about more code, like model, controller, etc.

Have you viewed Jeffrey's intro video series?

Here are references:

https://laravel.com/docs/5.6/eloquent#defining-models

https://laravel.com/docs/5.6/migrations

It would help you if you worked some of the examples from the docs.

LaybackSpin

Thank you for your suggestions. Snapey, when you said you need to create models. Are you referring the the "App\nameOfTable"? So this model file isn't auto generated? I'm working on a project made by a previous team and so I have the "App___" files of pre-existing tables. The syntax in those files seem confusing so I gathered it was auto-generated by artisan.

jlrdw
jlrdw
2 months ago (251,930 XP)

https://laravel.com/docs/5.6/eloquent#defining-models

I guess don't even bother reading that.

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