1

Is just a question about laravel seeding, if I want to make my app portable, it is a good practice to save app-work-essential data in DatabaseSeeder laravel class?

If not? How could I do it?

Lin Du
  • 88,126
  • 95
  • 281
  • 483
gmoros-dev
  • 25
  • 5
  • 4
    Define "real". Does this mean "contains sensitive secrets"? Usually the seeds contain enough data to bootstrap the app, but nothing critical. – tadman Apr 25 '19 at 19:28
  • Is the data you want to seed sensitive? Can other developers see it in version control? If not, either don't seed it like this or don't version control the file. If its data that is required for the app to run, then i think it'd be fine to have it in the seeder. – FunkyMonk91 Apr 25 '19 at 20:18

1 Answers1

3

Seeding is used to bootstrap the application. If the data is just enough to get the application up, seeding is the official way to do this; especially if you are in an environment using Continuous Integration/Deployment. The paradigm is that you, as developer, shouldn't have to have direct access to the database to install or update the application. I don't necessarily believe that needs to be true, but it is a nice ideal to shoot for, as it means the code will be more portable.

One very important exception is based on the idea that the seeder is typically versioned, so it shouldn't contain sensitive or private information. Things like real user password hashes (a temporary admin password is alright), HIPAA, FERPA, social security numbers, bank account information, etc. etc.

J. A. Streich
  • 1,683
  • 10
  • 13