Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

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
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)


Hi Samuel,

You may refer to laravel documentation;
https://laravel.com/docs/10.x/migrations#generating-migrations

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
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(