Home>Article>PHP Framework> Laravel fake data filling simple steps

Laravel fake data filling simple steps

little bottle
little bottle forward
2019-04-24 13:59:36 2726browse

This article mainly talks about the steps of filling in fake data in laravel. It is simple and convenient. Friends who are interested can learn about it. I hope it can help you.

  1. Define the modelxxx.php
  2. Define the rules for data generationdatabase/factories/XxxlFactory.php
  3. Write the code to generate data, control the number of generated data, and make modifications to the generated datadatabase/seeds/XxxTableSeeder.php
  4. Registration

(For fields that are hidden$hiddenin the model, you need to use the makeVisible() method to temporarily stop hidden, and an error occurs when writing to the database)

Related Tutorial:laravel video tutorial

The above is the detailed content of Laravel fake data filling simple steps. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete