amitmerchant1990 / amitmerchant-dot-com-comments

1 stars 0 forks source link

invisible-mysql-columns-in-laravel-8x/ #39

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Invisible MySQL columns in Laravel 8.x – Amit Merchant – A blog on PHP, JavaScript, and more

Let’s imagine a scenario where you have a MySQL table called users and there’s a column called secret which holds a secret token for the associated users.

https://www.amitmerchant.com/invisible-mysql-columns-in-laravel-8x/

RobinBastiaan commented 2 years ago

Very good feature and article! It is probably a good practice to add all your important PII's like email and social security numbers to this feature.

I just wanted to note that it is also possible to define this on the model itself using protected $hidden = ['secret'];. Eloquent also comes with a handy ->makeHidden('attribute') method to temporary make an attribute hidden. I will have to play around and get more experience with these hidden options to see what has my preference. It would probably be a bit confusing to use both at the same time.