We always use fake data when we create our software. In laravel we use faker to generate fake data. But this faker can be used only in seeder or factory class or in our controller if we used it.
But This PR by Tim MacDonald adds a global
fake() helper to create fake data in Laravel 9.x application. Now we can use this
fake() function in the entire application. Even in our blade file also.
See the below example of fake() helper: Assume we are in blade components:
To insert value:
DB::table('users')->insert(['name' => fake()->unique()->name()]);
Read also: How to Create Dynamic Nav Bar From Database in Laravel?
Hope it can help you.