DiscoverNo CompromisesMove that logic out of your view
Move that logic out of your view

Move that logic out of your view

Update: 2024-02-06
Share

Description

Ever feel like your Blade views are getting too logic-heavy? What logic belongs in the view, and what logic would be better somewhere else? We use a recent PR discussion to talk through these points.

  • (00:00 ) - Trying to keep logic out of the Blade view

  • (02:00 ) - Using the simplest form of logic

  • (03:45 ) - Business logic doesn't belong in the view layer

  • (04:15 ) - Condition moved into the controller

  • (05:20 ) - Secondary benefit of testing


Check out the Mastering Laravel YouTube channel
Comments 
00:00
00:00
1.0x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

Move that logic out of your view

Move that logic out of your view

Joel Clermont and Aaron Saray