Тёмный
No video :(

Laravel Code Review: Validation Rules, Events, Seeds and Shorter Code 

Laravel Daily
Подписаться 143 тыс.
Просмотров 10 тыс.
50% 1

Опубликовано:

 

16 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 37   
@JustinByrne1337
@JustinByrne1337 3 года назад
Thanks Povilas for all the positive feedback. The Seeders were added to the migrations as I was uncertain on how to prevent them from being run multiple times while is on the dev server. I have since realised that I could just use php artisan db:seed --class=AllergenSeeder for current dev and leave it in the DatabaseSeeder class for new installations
@LaravelDaily
@LaravelDaily 3 года назад
Also, in all the seeds you could run firstOrCreate() or updateOrCreate() on all records, so if they exist, they wouldn't be created again when seeds are run for the second time, for whatever reason.
@pawelpason1501
@pawelpason1501 3 года назад
Check doctrine approach. Seeders are overengineering :)
@Farishrf
@Farishrf 3 года назад
Quick performance tip: At 8:20 in line 47. It'd be best to take out the count() function from the for loop and put it in a variable. because every loop you are executing count() function again. It might not make sense In this situation because I assume ingredients aren't that many, but in other scenarios, it might help.
@TsA1ex
@TsA1ex 3 года назад
At 9:11 you can add second condition inside Gate logic and use only one condition
@hedgefund9999
@hedgefund9999 3 года назад
true
@ryanb509
@ryanb509 3 года назад
Unless its on an older version of Laravel before it was a thing, there is a built in rule for the current password called "current_password".
@aleksandarstevanovic5854
@aleksandarstevanovic5854 3 года назад
well in my opinion, i would use seeder in migrations only if i need data in table right from the start, for example i have "countries" table which doesn't change a lot and i have foreign keys from "addresses" table... other example is "product_states" table i have only new and used records (maybe client will add some more later)... but nicely done factories are a bit better solution for this example... other example is maybe if a client wants a slug and not id in urls, and i don't have "slug" column... so i would make a migration, create a "slug" column in it and right after foreach record fill the column, because i will definitively forget to run seeder on deployment
@ryiad2010
@ryiad2010 6 дней назад
wonderful review
@patrick-dev
@patrick-dev 3 года назад
I believe that Laravel has a default validation rule for checking and validating a given password against the authenticated user's password. I don't see why would he create a custom rule for that.
@pawelpason1501
@pawelpason1501 3 года назад
Running seeders through migrations is the most correct approach. First of all, in the CD / CI migrations will be started and you will not need to create additional conditions to run when new seeders are created in the application. How you run new seeders on a working application? Manually? Second, you can rollback at any time and delete this data if anything goes wrong. By default, seeder mechanism does not provide such an option and creating ex. RemoveUsersSeeder is simply pointless.
@JustinByrne1337
@JustinByrne1337 3 года назад
The CI/CD is my more recent reason for using the seeder in the migration.
@syedanwarahmedshah3705
@syedanwarahmedshah3705 3 года назад
Thanks sir you are great :) and a gem for laravel devs
@hassanfazeel2354
@hassanfazeel2354 3 года назад
How to use two arrays in a single foreach loop ?possible?
@mhyeganeh
@mhyeganeh 3 года назад
That was awesome! 👍 So many thanks
@tarekalhalabi8776
@tarekalhalabi8776 3 года назад
Love this videos💙
@maxgoose4671
@maxgoose4671 3 года назад
Povilas, greetings! Could you give me an advice, please. When building an API on Laravel, what should i use for editing data on output. Eloquent Mutators or API Resources?
@LaravelDaily
@LaravelDaily 3 года назад
API Resources: laravel.com/docs/8.x/eloquent-resources
@mahmoudadel8313
@mahmoudadel8313 3 года назад
Can you make video about seo
@GergelyCsermely
@GergelyCsermely 3 года назад
Thanks, interesting!
@ward7576
@ward7576 3 года назад
I could actually try to send in something for code review, since I haven't gotten a CR from my more knowledgeable peers for like 2-3 solid years lol
@LaravelDaily
@LaravelDaily 3 года назад
I currently have a long queue of reviews already, so realistically only in September.
@ward7576
@ward7576 3 года назад
@@LaravelDaily Good, they are really good ways to learn. I have done those to juniors I meet at my client companies, they learn quickly and they actually adopt. Sort of the feeling you get when teaching something new to your kid and just being proud about him progressing lol
@TsA1ex
@TsA1ex 3 года назад
New bad fast refactoring. At 8:03 you lost 'adults' and 'kids' values if checkbox not checked. Because there is request->has
@LaravelDaily
@LaravelDaily 3 года назад
Good catch, should have noticed that one. Need to be more careful in the future.
@bumblebity2902
@bumblebity2902 3 года назад
Maybe use setAttributes function, if it is need to pass checkbox values.
@user-vs4sd6lw5e
@user-vs4sd6lw5e 3 года назад
I'm sorry, that my question is not actual for this video, but tell please, how currect in Laravel 8 remove "public" segment from url ? Thank you.
@ward7576
@ward7576 3 года назад
say it in russian, I can re-translate so it's understandable much better.
@maxgoose4671
@maxgoose4671 3 года назад
Ты на хостинге чтоль используешь? И, если да, то на каком?
@user-vs4sd6lw5e
@user-vs4sd6lw5e 3 года назад
@@ward7576 Поставил laravel 8 на Open Server для локальной разработки и не могу найти мануал как правильно в 8й версии удалить сегмент "public" из url.
@user-vs4sd6lw5e
@user-vs4sd6lw5e 3 года назад
@@maxgoose4671 Пока поставил только на локальный вебсервер (Open Server)
@maxgoose4671
@maxgoose4671 3 года назад
@@user-vs4sd6lw5e Сари в чем дело то. Как бы, папка бублик ваще не должна быть в урл. Я так понял, у тебя http:127.0.0.1:8000/public/mypage только открывает? Или как? Скинь урл.
3 года назад
ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-qyJ_yZuV5gY.html i have question about $recipe->ingriends()->attach()... does it checks in database if hat record exists? if no, what happens if i add custom ID to dropdown or checkbox.
Далее
Laravel API+Vue Code Review: 12 Things I've Noticed
22:31
Laravel Junior Code Review: 12 Tips on Everything
15:30
Enums considered harmful
9:23
Просмотров 202 тыс.
Don't Use Polly in .NET Directly. Use this instead!
14:58
I forced EVERYONE to use Linux
22:59
Просмотров 356 тыс.
Laravel: Create Public API with Cache and Rate Limits
12:18
Laravel Eloquent: Deeper Relationships with One Query
10:37
The Logging Everyone Should Be Using in .NET
15:34
Просмотров 57 тыс.
4 Tips To Succeed As A Self Taught Developer
11:08
Просмотров 33 тыс.
The Greenwich Meridian is in the wrong place
25:07
Просмотров 739 тыс.
9 Tips for Shorter Laravel Code
10:16
Просмотров 61 тыс.
The Clever Way to Count Tanks - Numberphile
16:45
Просмотров 928 тыс.