Laravel DB Raw Queries: SQL Injection - How to Protect

Laravel DB Raw Queries: SQL Injection - How to Protect

Laravel Daily

2 года назад

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

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


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

Logan Nathan
Logan Nathan - 16.02.2022 08:54

thanks for sharing

Ответить
Salahuddin Ayubi
Salahuddin Ayubi - 10.02.2022 22:26

Suggestion:
Laravel provide excellent way of query data with Eloquent Modal and eloquent make things very easy for developers specially for beginners as it provide security, relations, softDeletes, mapping data and much more but in some cases Eloquent effect application performance when DB's tables contain a lot of data so for this purpose COMMUNITY recommend to use Laravel Query Builder that fetch data early as compare with Eloquent Modal.
I think Laravel team should focus on Eloquent performance.

What do you think??

Ответить
Adnan Shabbir
Adnan Shabbir - 10.02.2022 15:44

Thank you

Ответить
Anees Khan
Anees Khan - 07.02.2022 22:00

what about orderByRaw() ? does this also do bindings?

Ответить
Ex Hindu Hussain - revert  muslim(khilafah seeker)
Ex Hindu Hussain - revert muslim(khilafah seeker) - 07.02.2022 21:51

hello sir can you please give solution to how to sort outer array with inner array properties in eloquent relationships .
i mean if user->with(profile) , then how to sort this relationship by any inner array attribute of profile relationship .

Ответить
Kevin Bowie
Kevin Bowie - 07.02.2022 17:32

This is Just like the old basic PHP PDO concept 👍🏿

Ответить
Nayaz Ahmed
Nayaz Ahmed - 07.02.2022 16:34

Sir will you make a video on api gateway in laravel for micro services

Ответить
amit dev
amit dev - 07.02.2022 16:03

We have to use parametrized query...we can also use as parameter name like using : instead of ?

Ответить
Phuoc Tran Ngoc
Phuoc Tran Ngoc - 07.02.2022 14:03

It same using PDO bindParam() with ? mark.

Ответить
Paulius Pagojus
Paulius Pagojus - 07.02.2022 14:01

Amazing, yesterday I was doing exactly this where I need to search students by fullname uses whereRaw with variable dirctly in whereRaw and now i will change it to the example you provided. Your timing is perfect as allways!

Ответить
Ali Al Qahtani
Ali Al Qahtani - 07.02.2022 12:57

Thx

Ответить
Yhael López
Yhael López - 07.02.2022 11:42

I got it, but I don't understand how does that can break into security, I mean, the query would give error in any case different, no?

Ответить
Bro Jenuel
Bro Jenuel - 07.02.2022 11:03

awesome!

Ответить
LifeCycle vLog
LifeCycle vLog - 07.02.2022 09:34

Stock::updateOrCreate(
['medicine_id' => $purchaseItem->medicine_id, 'batch_id' => $purchaseItem->batch_id],
['stock' => DB::raw('stock+'.$purchaseItem->quantity), 'expiry_date' => $purchaseItem->expiry_date]
);

Whats the bettere way here with DB:raw?

Ответить
Ajay Kumar
Ajay Kumar - 07.02.2022 09:12

Named parameter will work here?

Ответить
Akhzar Javed
Akhzar Javed - 07.02.2022 09:05

New addition to my knowledge.

Ответить
Gergely Csermely
Gergely Csermely - 07.02.2022 09:02

Thanks

Ответить