Thoughts, etc.

Tracking the occasional random walk

snippets

Getting a Faker instance in Laravel’s tinker environment

2018-05-03 / 3 Comments

I sometimes find that it would be useful to use  artisan tinker to play with the sorts of data that Faker will generate in a Laravel factory. Unfortunately I don’t do it often enough to always remember the correct way to do it, since the obvious  new Faker\Generator doesn’t work. So for future reference, what you need is:

1
>>> $faker = Faker\Factory::create();

 

Posted in: snippets Tagged: laravel, notes