Snippets

Generate Fake Data with PHP using Faker

Playing
Generate Fake Data with PHP using Faker
14 mins8 years ago

Speed up development and use Faker to generate fake data, like words, paragraphs, names, email addresses, and so much more! Here, we look at seeding a database with 100 records of data at the click of a button.

Alex Garrett-Smith
Hey, I'm the founder of Codecourse!

Comments

No comments, yet. Be the first to leave a comment.

Suggested courses

PHP

Build An Uptime Monitor with Inertia

Ready to dive into Inertia? Let's build a real-world app with Laravel, Inertia and Vue! If you're already working with Inertia, you'll pick up some tips and techniques for future projects. This uptime monitor allows you to create and switch between sites, then add endpoints to monitor with frequency intervals. Using the power of scheduling and queues, it'll automatically alert the email addresses you've added via the UI when an endpoint goes down. In this course, you'll learn to: * Build a real app from scratch with Inertia * Work with Laravel queues * Perform actions on models at user-defined intervals * Work with sub-minute schedules in Laravel * Send out channel notifications with Laravel * Use API resources to simplify Inertia data * Organise apps with events and observers * Create modals in Vue * Perform inline editing with Inertia forms

44 episodes
4 hrs 59 mins
PHP

Dropdown Autocomplete Search Anything in Laravel

Using the power of Laravel Scout and Meilisearch, let’s build an instant dropdown search in your Laravel apps. We’ll start with the basics of indexing data, then use the JavaScript autocomplete library to instantly show results as the user types — even multiple sources at the same time!

12 episodes
1 hr 3 mins
PHP

Crop and Upload Profile Photos with Livewire

Using Livewire, Alpine and Cropper.js (or any cropping library), we’ll create an embeddable form field for users (or any other model) to upload profile photos. The form element will launch a modal, where users can crop and adjust their profile photo, before being able to preview and save the cropped image — or clear everything out and start again. You’ll learn: - How to launch modals in Livewire - How to use Cropper.js with Alpine - How to resize images on the backend with the spatie/image package - How to pass data between Livewire components

10 episodes
43 mins
PHP

Logging Unique Views in Laravel with Redis

If you need to log unique views in Laravel, you might reach for a database table to track IP addresses or another unique piece of data. Let's take a look at speeding things up both in performance and complexity by using Redis and the HyperLogLog probabilistic data structure. Once we're done, we'll set up a period command to sync views back to the database for easy ordering, and then create a trait to share functionality between other models.

4 episodes
22 mins