PHP 8.1: Enums - Everything You Need To Know | How to use enumerations in Laravel?
PHP 8.1 adds support for Enumerations. An Enumeration, or an #Enum for short, is an enumerated type that has a fixed number of possible values. That's all cool and stuff, but what's a practical real-world example of where we would want this? How could this be used by developers in their projects? In my explanation, I'll use #PHP and #Laravel code, but the idea behind enums can be applied to other PHP frameworks or core PHP as well.
▶ Enums in PHP v8.1 Explained in detail with examples.
https://qirolab.com/posts/what-is-enumerationsenums-in-php-81-1663671157
▶ How to use the enumerations(Enums) of PHP 8.1 in Laravel?
https://qirolab.com/posts/how-to-use-the-new-php-enum-in-laravel-1663697723
▶ #1: Single Responsibility Principle (SRP)
https://www.youtube.com/watch?v=OmtLxnjMnlY
▶ #2: Open-Closed Principle (OCP) in PHP, Laravel
https://youtu.be/AOTb2zIpdcQ
▶ #3: Liskov substitution principle (LSP) in PHP, Laravel
https://www.youtube.com/watch?v=Vq-dJr1DGwk
▶ #4: Interface Segregation Principle (ISP) in PHP, Laravel
https://www.youtube.com/watch?v=i52dA5gmUg0
▶ #5: Dependency inversion principle (DIP) in PHP, Laravel
https://www.youtube.com/watch?v=QE6HN8evtnw
▶ How to modify created_at & updated_at timestamps in Laravel?
https://www.youtube.com/watch?v=0ofKuncEh-0
▶ How to use UUID as the Primary key instead of auto-increment IDs in the Laravel application?
https://www.youtube.com/watch?v=1XIMI5kOPuc
▶ Laravel Model Lifecycle Events and How to use Observers in Laravel?
https://www.youtube.com/watch?v=7GUaH6BI_V0
▶ #1: SPA Authentication using Laravel Sanctum
https://www.youtube.com/watch?v=8Uwn5M6WTe0
▶ #2: API Token Authentication using Laravel Sanctum
https://www.youtube.com/watch?v=2bslfjKEAik
▶ Laravel Eloquent Relationships
https://www.youtube.com/playlist?list=PL1TrjkMQ8UbVyIT0cDX-54gN5tunWZvaI
TABLE OF CONTENTS
00:00 - Intro
00:13 - Before built-in Enums, the use of Constant & the problem of it.
09:39 - Introduction of PHP 8.1: Enums feature.
11:36 - Pure enums vs Backed enums.
14:52 - Access value of Backed enums.
15:58 - The solutions to the problems with the usage of Constants using Enums.
18:25 - Methods in enums.
19:19 - `from()` & `tryFrom()` methods in the Enums.
22:10 - Methods in enums.
27:01 - Enum Attribute Casting in Laravel Application
28:28 - Store or update Enum values in the Database in Laravel App
29:41 - Get a list of all cases
33:01 - Enum validation rule in Laravel
34:46 - Classes vs Enums
36:29 - Traits
37:34 - Classes vs Enums
Support my work:
On BuyMeACoffee: https://www.buymeacoffee.com/qirolab
???????????? ????????
https://m.do.co/c/e740238537d0
Also, follow us on:
????????: https://fb.com/qirolab
???????: https://twitter.com/qirolab
Видео PHP 8.1: Enums - Everything You Need To Know | How to use enumerations in Laravel? автора VueJS: Секреты Успешной Разработки
Видео PHP 8.1: Enums - Everything You Need To Know | How to use enumerations in Laravel? автора VueJS: Секреты Успешной Разработки
Информация
28 ноября 2023 г. 20:34:18
00:38:28
Похожие видео