Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to export the data of data table and generate seeds seed file by Laravel

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is a detailed introduction to "how Laravel exports the data of the data table and generates the seeds seed file". The content is detailed, the steps are clear, and the details are properly handled. I hope this article "how Laravel exports the data of the data table and generates the seeds seed file" can help you solve your doubts. Let's go deeper and learn new knowledge together with the ideas of the small editor.

Install isseed

Install isseed. I have laravel 5.4 here. The installed iseed is version 2.1. You can see the situation. Feel free.

composer require "orangehill/iseed": "2.1"

Add iseed to the composer.json file

Add iseed to service provider

Add providers to laravel project directory config/app.php

'providers' => [ ... Orangehill\Iseed\IseedServiceProvider::class,],

Update composer command line execution

composer update

This is the end of installation

Iced usage

Export data for a single table

For example, if I want to export the data of a table to a seed file, then the command is: php artisan iseed The table name you want to convert

If I want to export data from a user table, the command would be:

php artisan iseed users

Export data from multiple tables

Similar to exporting a single, multiple tables separated by commas

php artisan iseed Table 1, Table 2

Export data and force overwrite

Sometimes when we export, the seed file already exists and we have to overwrite it. How do we do that?

It's very simple. Everything else remains the same. Just add--force to the command and it's OK.

php artisan isedtable name1 [, tablename2...]-- force

Export specified tables from specified databases and generate seed files

php artisan iseed table name--database= database name Read here, this article "Laravel how to export the data table and generate seeds seed file" article has been introduced, want to master the knowledge of this article also need to practice to understand, if you want to know more about the content of the article, welcome to pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report