Create table using CMD command in laravel

Just open command prompt, and go in your project directory like

if your project is present in f drive , it means, you need to go in first f drive of your computer,

C:\Users\username>

suppose above written line show in your cmd when you open then

your statement should be ,

C:\Users\username>cd ..           (here, your will move one step back)

C:\Users>cd ..                           (here, your will move one more step back)

C:\ f:                                               (just f: and press enter , now you will reach in f drive)

F:\ cd xampp                                 (now you will reach in xampp folder of f drive)

F:\xampp>                                     ( write cd and folder_name to enter in your directory)

F:\xampp> cd htdocs                   (now you reach in htdocs of xampp folder )

F:\xampp\htdocs>  cd project_name 

in cmd move back -> cd ..
in cmd move ahead -> cd folder name
when you open cmd then go in xampp folder like
cd xampp\htdocs\project-folder-name and then press enter
now just write:
php artisan make:migration create_table_name_table    (syntax)

here, table_name should be in plural form for e.g., we want to create student table in database

or cmd code is:

php artisan make:migration create_students_table         (and  press enter)

after few second a message show that  your migration table has been generated

something like this, a message generated:

Created Migration: 2019_10_02_165722_create_cococlas_table

and if you want to add some extra columns in your table then go to your project and

open databse> migrations> table

and add columns if you want and save it

and write this command  in your cmd folder root path

php artisan migrate

your migration message should be generate here,

and after that your created table will be available for you in your database of  phpmyadmin

 

This is the easiest way of generate table using cmd command in LARAVEL………..

Leave a Reply