Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

How can I use other tables from Demo 1 in Laravel?


Good afternoon,
I am using Metronic 8.2.1 Laravel, and by default, it comes with the users table, and I would like to know how I can insert other tables, and what is the most appropriate way to do it. For example, fetching the tables from the eCommerce Catalog and using them.
Could you please explain to me how with an example?
Thank you very much!


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi Samuel,

You may refer to laravel documentation;


To add new tables to your Laravel project, here is some general steps:

Generate Migration:
Laravel uses migrations to create database tables. Run the following Artisan command to generate a new migration file for your table:

php artisan make:migration create_table_name


Replace table_name with the actual name you want for your table.

Edit Migration File:
Open the generated migration file in the database/migrations directory.
In the up method, define the columns for your table using the available column types. For example:

public function up()
{
Schema::create("table_name", function (Blueprint $table) {
$table->id();
$table->string("name");
// Add other columns as needed
$table->timestamps();
});
}


Run Migration:
Run the migration to create the new table in the database: php artisan migrate

Model (Optional):
If you want to interact with the table using Eloquent models, you can create a model using the following command: php artisan make:model TableName
Replace TableName with the actual name for your model.

Repeat these steps for each additional table you want to add to your Laravel project. After running migrations, your new tables will be available in the database.

I hope this helps! Let me know if you have further questions.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(