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

Laravel fake data filling simple steps

little bottle
little bottleforward
2019-04-24 13:59:362836browse

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 model xxx.php
  2. Define the rules for data generation database/factories/XxxlFactory.php
  3. Write the code to generate data, control the number of generated data, and make modifications to the generated data database/seeds/XxxTableSeeder.php
  4. Registration

(For fields that are hidden $hidden in 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