Enums in Laravel

9 episodes 31 mins

Course overview

Enums make working with multiple potential column values a breeze (think order statuses). Let's use an Enum in Laravel and cover storing, validating and accessing Enums.

By the end of the course, you'll be able to implement Enums in Laravel with ease, and make sure your multiple choice column data is strict and easy to globally update across your entire application.

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

Related courses

PHP
PHP Enums

Enums represent a typed set of possible values in PHP. For example, if you're storing a Book that can have a status of __want to read__, __reading__ or __read__, an Enum will hold these values in one place that you can reference anywhere. Prior to PHP 8.1 (when Enums were added), you'd have to work with a simple class with constants. While that works fine, it doesn't provide much power under the hood. In this course, we'll look at the power of Enums and how they can drastically simplify your code.

31 mins