Conor
Conor

Reputation: 2563

How to add a table to my preexisting database using laravel?

Hi guys I am new to laravel.
I just started my project for a login
I create a project and made a successful login using the command php artisan make:auth.
Now i am trying to create a comment system.I want guide to create it.
Please tell me how can i send the data with a button from the textarea to a new table in my preexisting database and to receive that data to my commentarea.
Thank you

Upvotes: 2

Views: 113

Answers (1)

Advaith
Advaith

Reputation: 2580

  • Create a migration using php artisan make:migration <name of the file>. For eg. i am using name of the file as conor.
  • php artisan make:migration conor
  • open your conor.php file in databse/migrations
  • In the up() function you can see there is an already created Schema::create
  • In it you can also see $table->increments('id'); something like this also
  • Just keep adding $table->+<name of the tabel structure>+('<name of the column>');
  • Just before php artisan serve do an one time php artisan migrate to register the table

Upvotes: 1

Related Questions