skip to Main Content

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


  1. 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

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
  3. Yes
    But when two or more programmers are writing together, they are not recommended.
    GIT can help us better. Even in the database context

    Login or Signup to reply.
  4. 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!

    Login or Signup to reply.
  5. 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

        <?php
    
    namespace App;
    
    use IlluminateDatabaseEloquentModel;
    
    class Car extends Model
    {
        protected $table = 'car';
    }
    

    with protected $table = 'car' you attach the car table to car model , and you’re done

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search