1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 13:24:03 +00:00

Weekly thread #2 (#24)

This commit is contained in:
lukinovec 2022-01-14 19:18:35 +01:00 committed by GitHub
parent 36a9c5eec0
commit 0e34bd3779
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 92 additions and 1 deletions

View file

@ -0,0 +1,11 @@
---
title: 'Form elements can have a "target" attribute which works very similarly to <a> tags'
tweet_id: '1482036555883560961'
thread_slug: weekly-thread-2022-02
author_username: jbrooksuk
images:
- 'https://pbs.twimg.com/media/FI-ZzcDWQAED8P2.jpg'
created_at: 2022-01-14T17:07:04+00:00
slug: form-elements-can-have-a-target-attribute-which-works-very-similarly-to-ltagt-tags
---
Did you know that "form" elements can have a "target" attribute too?

View file

@ -0,0 +1,11 @@
---
title: 'You can add the context() and render() methods to custom exceptions'
tweet_id: '1482036568852348928'
thread_slug: weekly-thread-2022-02
author_username: SteveTheBauman
images:
- 'https://pbs.twimg.com/media/FI6OtPbXEAMoUWL.jpg'
created_at: 2022-01-14T17:07:07+00:00
slug: you-can-add-the-context-and-render-methods-to-custom-exceptions
---
If you're creating custom exceptions inside your Laravel application, you can add a "context()" method to provide additional data to be printed in the log, as well as a "render()" method to allow the exception to display its own view to the user. Super cool! 🤩

View file

@ -0,0 +1,11 @@
---
title: 'You can use @includeWhen to include certain Blade partials when some condition is met. For instance, when the current user is an admin'
tweet_id: '1482036560354676737'
thread_slug: weekly-thread-2022-02
author_username: marcelpociot
images:
- 'https://pbs.twimg.com/media/FI47GaYXMAI7SeA.jpg'
created_at: 2022-01-14T17:07:05+00:00
slug: you-can-use-at-includewhen-to-include-certain-blade-partials-when-some-condition-is-met-for-instance-when-the-current-user-is-an-admin
---
Make use of the built-in "includeWhen" and "includeUnless" directives to get rid of those ugly if conditions.

View file

@ -0,0 +1,11 @@
---
title: 'You can use the @production Blade directive to load specific scripts only in production mode'
tweet_id: '1482036552242892803'
thread_slug: weekly-thread-2022-02
author_username: ecrmnn
images:
- 'https://pbs.twimg.com/media/FI_vAnAWQAEddIH.jpg'
created_at: 2022-01-14T17:07:03+00:00
slug: you-can-use-the-at-production-blade-directive-to-load-specific-scripts-only-in-production-mode
---
The @.production blade directive makes it super easy to load e.g. Google Analytics or other stuff when your Laravel app is in production mode

View file

@ -0,0 +1,11 @@
---
title: 'You can use the value() method in Eloquent to fetch a single column from the DB'
tweet_id: '1482036550967853057'
thread_slug: weekly-thread-2022-02
author_username: SteveTheBauman
images:
- 'https://pbs.twimg.com/media/FJEgq7SXwAE5rpl.jpg'
created_at: 2022-01-14T17:07:03+00:00
slug: you-can-use-the-value-method-in-eloquent-to-fetch-a-single-column-from-the-db
---
Just learned about the Eloquent "value()" method from @amaelftah 💪. Eloquent make things so easy. Seems like there's shortcuts hiding everywhere, I love it! 💅🤩

View file

@ -0,0 +1,15 @@
---
title: 'Your CLI commands in Laravel can provide auto-complete for the terminal'
tweet_id: '1482036564746129410'
thread_slug: weekly-thread-2022-02
author_username: AshAllenDesign
images:
- 'https://pbs.twimg.com/media/FI-pr9tXEAURLrX.jpg'
created_at: 2022-01-14T17:07:06+00:00
slug: your-cli-commands-in-laravel-can-provide-auto-complete-for-the-terminal
---
Did you know that you can provide auto-complete hints for your commands in Laravel?
These can be pretty helpful in your internal CLI tools that you have in your projects 🚀
#laravel #php