mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-12 05:14:04 +00:00
Week 28/2022
This commit is contained in:
parent
d5718fbbc8
commit
9ff2f9816b
6 changed files with 68 additions and 1 deletions
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
title: 'Be careful if you''re not scoping your route model bindings '
|
||||
tweet_id: '1547939806788734976'
|
||||
thread_slug: weekly-thread-2022-28
|
||||
author_username: realstevebauman
|
||||
images:
|
||||
- 'https://pbs.twimg.com/media/FXoucXVUEAINVm5.jpg'
|
||||
created_at: 2022-07-15T13:43:03+00:00
|
||||
slug: be-careful-if-youre-not-scoping-your-route-model-bindings
|
||||
---
|
||||
I've caught myself writing this security bug many times in controllers, making the assumption that Laravel will retrieve child route bound models by the parent model *by default*. Be careful if you're not scoping your route model bindings!
|
||||
17
content/tips/you-can-time-travel-in-your-tests.md
Normal file
17
content/tips/you-can-time-travel-in-your-tests.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
---
|
||||
title: 'You can time travel() in your tests '
|
||||
tweet_id: '1547939812220407808'
|
||||
thread_slug: weekly-thread-2022-28
|
||||
author_username: ecrmnn
|
||||
images:
|
||||
- 'https://pbs.twimg.com/media/FXevKR8UIAAY40z.jpg'
|
||||
created_at: 2022-07-15T13:43:05+00:00
|
||||
slug: you-can-time-travel-in-your-tests
|
||||
---
|
||||
🔮 Travel in time in your Laravel tests.
|
||||
|
||||
Using the *travel()* method you can travel back and forward in time.
|
||||
|
||||
No more Carbon::setTestNow()
|
||||
|
||||
Super useful 👏
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
title: 'You can use `Str::markdown` to build translation strings '
|
||||
tweet_id: '1547939801373892620'
|
||||
thread_slug: weekly-thread-2022-28
|
||||
author_username: danjharrin
|
||||
images:
|
||||
- 'https://pbs.twimg.com/media/FXKnQBLWQAAVcuQ.jpg'
|
||||
created_at: 2022-07-15T13:43:02+00:00
|
||||
slug: you-can-use-strmarkdown-to-build-translation-strings
|
||||
---
|
||||
Ever needed to add HTML *inside* a Laravel translation string, and had to split the string up into chunks?
|
||||
|
||||
Or felt bad about raw HTML in your translations?
|
||||
|
||||
Here's a little cheat - parse markdown. Most of the formatting you want to do inside a translation string is available. 🤷♂️
|
||||
Loading…
Add table
Add a link
Reference in a new issue