Enums in PHP/Laravel: Add More Functionality

Enums in PHP/Laravel: Add More Functionality

Laravel Daily

1 год назад

18,887 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Moemen Gaballah
Moemen Gaballah - 09.04.2023 11:24

nice thanks

Ответить
Asdrúbal Perez
Asdrúbal Perez - 26.02.2023 03:34

would it not be easier to save those values in a database? because maybe changing the code to add one more attribute would be a little harder depending on the company, and adding a value to a table with a model would be easier, and maybe save some special data in the database as json to make it more flexible.

Ответить
Flankymanga
Flankymanga - 16.02.2023 22:31

I have seen such Enums

Ответить
Ngọc Bảo
Ngọc Bảo - 16.02.2023 05:47

Many thanks sir, I was very confused as to how to convert enum value to number (to save in database). The video is really helpful. Thank you

Ответить
Bremg
Bremg - 15.02.2023 09:47

View classes etc in an Enum..

Ответить
Pat Fox
Pat Fox - 14.02.2023 23:31

I like the helper methods, but the suggestion of putting CSS classes and/or HTML here just smells bad.

Ответить
Emeka Timothy Iloba
Emeka Timothy Iloba - 14.02.2023 23:17

Sir. Thanks for your videos. They really help me. Please i have a question. Why is it that in the MVC pattern sometimes the model handles some business logic. i thought that thats the responsibility of the controller

Ответить
Javier Pazos
Javier Pazos - 14.02.2023 21:11

Just the video that I needed, at this point of time. Thank you so much.

Ответить
Robert Wayne
Robert Wayne - 14.02.2023 20:58

i add a trait to my enums for niceties like all(), sugar for cases()

Ответить
Vugar Khalil
Vugar Khalil - 14.02.2023 20:24

Красавчик, браво!👍

Ответить
Богдан Петренко
Богдан Петренко - 14.02.2023 17:39

Allways used with logic inside enum. But enum with HLTML looks like suxx. It shoul be some wrapper for enum

Ответить
Ilham Pamungkas
Ilham Pamungkas - 14.02.2023 14:26

Sir , Is livewire is suitable for building large scalable application?

Ответить
Cristyan Valera
Cristyan Valera - 14.02.2023 13:50

Excelent! Thanks Mr Povilas

Ответить
Prafful Panwar
Prafful Panwar - 14.02.2023 12:28

Used in almost all the project. One of my friend or mentor showed me this and from that day following the same approached.

Ответить
Pesheen Mstafa
Pesheen Mstafa - 14.02.2023 11:37

Is that good code practising of putting constants into config folder as a file called constants.php
And when you need them call that values from config(‘constants.userState’) for example ??!!!
Please can anyone help

Ответить
Inti Pontt
Inti Pontt - 14.02.2023 11:10

Having tailwind classes outside the views feels weird. But if you don't want to specifically add the classes you're using, you can just add the directory where your Enum class lives in the tailwind config file so it scans it as well.

Ответить
M B
M B - 14.02.2023 10:59

I literally wanted to email you about this, couple if days ago. I did the same, I'm using enums wherever is possible, but wasn't sure if that the best approach. I used it for example for settings page, by listing all possible settings fields, and each field has some states like: is enabled, value, html (actually a call to blade's view), etc. So basically when I want to add another settings field, this is the place to start of.

Ответить
Deusmar Júnior
Deusmar Júnior - 14.02.2023 10:47

Great feature 👏👏👏👏👏

Ответить
Timo Körber
Timo Körber - 14.02.2023 10:35

I also did a video on enums. But you managed to explain the advantages and possibilities in 5min whereas I took like 50 minutes :D

Ответить
Mayank Gajjar
Mayank Gajjar - 14.02.2023 10:14

I have not used this yet but would like to add when we start using PHP 8 in older projects. Thanks for sharing the knowledge with us. ☺

Ответить