can i add database table in my Laravel application by creating model file and database in phpmyadmin manually? Will everything work fine? Thanks in advance.
Reason: My application is already hosted in the net and i don’t know how to execute artisan commands in cpanel.
5
Answers
Yes you can add database table to your laravel application using model and migrations. Please refer this : https://laracasts.com/discuss/channels/general-discussion/makemodel-also-creates-a-migration
When a production environment doesn’t allow artisan commands, you can pull the production database down, run the migrations locally, and then upload the database back.
Alternatively, you definitely can create your tables manually, but it’s quite helpful to use migrations. They allow you to avoid manually adding tables in each environment — less room for errors.
I’d recommend Laravel Valet to get things running locally if you have a Mac. It’s quite simple to use. https://laravel.com/docs/5.5/valet
Yes
But when two or more programmers are writing together, they are not recommended.
GIT can help us better. Even in the database context
Yes, add what columns you need in
Schema::create
method of the table and then add columns manually to database as migration create them and its works!if you import a table to your database ,for access it with a model first create related model ,for example if you import the car table ,create car model in terminal then in your model
with
protected $table = 'car'
you attach the car table to car model , and you’re done