Тёмный

Junior Code Review: Try-Catch and DB Transactions 

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

Хобби

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

 

4 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 45   
@islandblaze007
@islandblaze007 3 года назад
Why is this channel not more popular? All of his content is first class and addresses real world issues!
@holiqibrahim
@holiqibrahim 3 года назад
In my opinion only channel here discusses laravel functions in detail, thank you
@cristianbasaez6270
@cristianbasaez6270 3 года назад
Hi!! Thank you so much for your videos, very simple, helpfull and comprensive, from Chile 🇨🇱!!
@jimmyvasquez7980
@jimmyvasquez7980 3 года назад
Bro! I have a year using laravel to créate my projects and your content have been so greate! Thanks
@AlexanderKotlyarov
@AlexanderKotlyarov 3 года назад
Like this codereview format. Keep it going.
@bboydarknesz
@bboydarknesz 3 года назад
This is great review, I love to see more like this, real case in programming world. May we have big code project review, like from route -> middleware -> service provider -> controller
@LaravelDaily
@LaravelDaily 3 года назад
There are so many topics and sub-topics for bigger project code reviews, that it wouldn't fit in my 5-10 minute video format on this channel. What exactly is the PROBLEM or QUESTION that you want to be discussed? How to use Service providers? Middleware? What is exactly unclear to you? Then I may narrow it down to specific video(s)
@bboydarknesz
@bboydarknesz 3 года назад
@@LaravelDaily Like, how to create Laravel project using its features so the apps will become more powerful and secure. maybe something like "Laravel apps structure pattern" ??? Sorry for my bad English, hope you understand what I mean :)
@LaravelDaily
@LaravelDaily 3 года назад
I have a separate long 4-hour course for this :) laraveldaily.teachable.com/p/how-to-structure-laravel-project But, remember, there's no ONE way, or even no FEW ways to structure the code. Especially in Laravel, as it's so flexible, you can find dozens of patterns, and all of them will be correct for THEM.
@JonnyJKF
@JonnyJKF 3 года назад
There is one example where wrapping a simple insert in a transaction could be useful: you can specify a second parameter which allows you to automatically retry the transaction in case it fails due to a deadlock or similar issue.
@madezine637
@madezine637 3 года назад
here I am, one of those juniors lol thanks a lot for the advice!
@pritek90
@pritek90 3 года назад
In first example we don't see a context of this save method on that model. This method could be overriden inside model with some additional sql inserts/updates/deletes. No need to use Carbon::parse, when in model u add date to model property $dates. Same to message attribute - we can use mutator inside model for this. Finally I would prefer using create method over save - sth like Contact::create($request->validated()), but in this case model property $fillable should be added to model with specific fields to save.
@konstruktion
@konstruktion 3 года назад
I always look forward to when you say the words "Hello Guys", "Posts" and "Request". That sounds so nice! 😊 Is there any way to send you my code or is there somewhere to apply? :)
@LaravelDaily
@LaravelDaily 3 года назад
You can send me the code via email povilas@laraveldaily.com and/or invite me to Github, username PovilasKorop But I don't do "general" code reviews anymore, you need to have some topic or question which would make a good video for RU-vid, on that topic.
@Jurigag
@Jurigag 3 года назад
1:56 also PDOException when saving
@spartacusyusuf9989
@spartacusyusuf9989 3 года назад
I feel if validation is properly done most times db transaction is not necessary.. thats my personal opinion, i use db transaction when i deal with relationship in case a model is deleted while the code is executed... Maybe yo do a tutorial on database concurrency in laravel.. thanks
@erlanggapb3168
@erlanggapb3168 3 года назад
So amazing, your review are soo good sir. It Just im not understand laravel. I only understand python-django. But still your code review are good
@arielperez3284
@arielperez3284 3 года назад
Very useful, thank you Mr.
@abdomohammed9522
@abdomohammed9522 3 года назад
Thank you for your great content , can you please talk about composed primary key and how we can use them in laravel
@dbelyaev
@dbelyaev 3 года назад
Great job, Povilas!
@msdeav
@msdeav 2 года назад
thank you...
@Michielofzo
@Michielofzo 3 года назад
Thanks for this video, do you have any video's on a multi-tenant laravel application (each customer has their own database and you switch based on who is logged in)? This could be a nice topic as a video. I personally would like to see how this would all interact with jobs/queues etc...
@LaravelDaily
@LaravelDaily 3 года назад
Not a very deep, but a short review of such project: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-8ot9IiGaqhk.html
@amitdev1485
@amitdev1485 3 года назад
Was waiting for it
@UsmanAli-yv6vo
@UsmanAli-yv6vo 3 года назад
awesome video as always
@TsA1ex
@TsA1ex 3 года назад
What if request doesn't have 'email' ? There is no validation for email, but Contact use $request->emal
@Jonstonrich
@Jonstonrich 2 года назад
Thank you a lot for your greate job.Can you tell me what is the color scheme used in your phpstorm?
@LaravelDaily
@LaravelDaily 2 года назад
Material Darker theme
@ahmadrio
@ahmadrio 3 года назад
terima kasih
@mix5003
@mix5003 3 года назад
4:14 i think it should keep that transaction. for something like model events or model observers.
@junaidwaqas6448
@junaidwaqas6448 3 года назад
sir i asked question what is the feature of bootstrap with laravel because laravel use taliwind css framework in laravel 8 jetstream
@GergelyCsermely
@GergelyCsermely 3 года назад
Thanks
@NotBeHaris
@NotBeHaris 3 года назад
Awesome
@kenjohnsiosan9707
@kenjohnsiosan9707 3 года назад
hi sir any tutorials of implementing event sourcing in laravel application. thanks
@weeb3277
@weeb3277 3 года назад
Do you post requests on topic somewhere so that people can send in their code specific to that topic?
@LaravelDaily
@LaravelDaily 3 года назад
I haven't done it before, but I think I will start doing it. First attempt I've done on Twitter, a few days ago: twitter.com/PovilasKorop/status/1374773763007512576 And will have a video on that topic. Do you have any other suggestions for topics?
@danishkhan5059
@danishkhan5059 3 года назад
how in try catch data insert update i use orm
@morgadoapi4431
@morgadoapi4431 3 года назад
Net Core snob here. PHP SUCKS! Kappa Everyone use they language they prefer and want, I don't care.
@udaranayana8305
@udaranayana8305 3 года назад
no no... in my opinion even redirecting back was too good... they should have straight up logged the user out from the system
@naderelmor4767
@naderelmor4767 3 года назад
Can anyone tell us what is name of this theme on phpstorm?
@LaravelDaily
@LaravelDaily 3 года назад
Material Darker
@Вячеслав-м9ч
@Вячеслав-м9ч 3 года назад
Благодарю
@catchmeifyoucan2815
@catchmeifyoucan2815 3 года назад
The single biggest mistake here is that there is business logic and data being processed in a controller.
@HadToChangeMyName_YoutubeSucks
@HadToChangeMyName_YoutubeSucks 2 года назад
I always use try/catch/finally for database actions, always. Even a simple transaction like saving a record in a single table can go foul and if it does I want to catch and handle it, I send alerts to the database and use webhooks to send myself a message that something went foul as well. Because I always use ajax to send data and get a return I always use finally so I can let the client app know that things went well or foul to let the user know. I write administrative software for our company and it's a standing joke that when something goes foul I'm going to be at your desk before you've had a chance to close the "an error occurred saving your data" alert. I work with code that was written 18 years ago by someone who was just learning to program so it's still full of really junk spaghetti code and terrible sql, and because there's so much of it I can't rebuild it all I've taken the trouble to go out and wrap entire functions in try/catch/finally just so I know when something goes wrong until I can get to rebuild it. Some of these functions are actually over 3000 lines long and just a mess of if statements and sql that's concatenated one variable at a time into a string before being executed with simple mysqli pass through executes, and while I rebuild as many as I can get to I also have to be constantly adding new functionality, so rebuilding existing code is a downtime effort. As far as transactions for a single row that makes no sense, if it fails there's nothing to roll back
Далее
Laravel Code Review: Why NOT Use Repository Pattern?
14:21
Junior Code Review: Cleaning Up Laravel CRUD
14:54
Просмотров 69 тыс.
How Many Twins Can You Spot?
00:17
Просмотров 22 млн
НОВАЯ "БУХАНКА" 2024. ФИНАЛ
1:39:04
Просмотров 526 тыс.
When to use Database Transactions? #dbms #dbmstutorials
13:26
Microservices are Technical Debt
31:59
Просмотров 419 тыс.
Being Competent With Coding Is More Fun
11:13
Просмотров 88 тыс.
Gitlab DELETING Production Databases | Prime Reacts
17:27
Laravel Junior Code Review: 12 Tips on Everything
15:30
Для кого праздник?
0:44
Просмотров 6 млн
Пастуший прыжок
0:39
Просмотров 8 млн