1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-11 21:14:02 +00:00

Weekly thread #5-#7, use actual created_at timestamp in Thread creation (#27)

* Weekly thread #5

* Weekly thread #6 (before #5)

* Weekly thread #5

* Correct the weekly thread created_at timestamps

* Add actual created_at to Thread

* Weekly thread #7

* Fix weekly thread #7

* Remove thread #8
This commit is contained in:
lukinovec 2022-02-21 17:24:21 +01:00 committed by GitHub
parent e907eba3dd
commit 1a53831d4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 363 additions and 3 deletions

View file

@ -39,6 +39,7 @@ class WeeklyThread extends Command
'tweet_id' => $id,
'author_username' => 'archtechx',
'content' => $tweet->text,
'created_at' => $tweet->created_at,
]);
while ($answer = $this->ask('Add tweet? Paste URL', 'no')) {

View file

@ -1,5 +1,5 @@
---
username: AshAllenDesign
name: 'Ash Allen'
avatar: 'https://pbs.twimg.com/profile_images/1396951805775466501/FSQQmSCQ_normal.jpg'
name: 'Ash Allen 🚀'
---

View file

@ -0,0 +1,5 @@
---
username: JackEllis
name: 'Jack Ellis'
avatar: 'https://pbs.twimg.com/profile_images/989296839194173440/ZRsVtbV5_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: MikeVILT
name: Mike
avatar: 'https://pbs.twimg.com/profile_images/1488516571073024001/t4KUs74i_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: Sileence
name: 'Duilio Palacios'
avatar: 'https://pbs.twimg.com/profile_images/916349154951081984/2rJdpjIi_normal.jpg'
---

View file

@ -1,5 +1,5 @@
---
username: aarondfrancis
avatar: 'https://pbs.twimg.com/profile_images/1492165477161914369/bXZG72Li_normal.jpg'
name: 'Aaron Francis'
avatar: 'https://pbs.twimg.com/profile_images/1433075605784997889/-Smrc71W_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: alanrezende
name: 'Alan Rezende'
avatar: 'https://pbs.twimg.com/profile_images/1404889748896993288/R7HpEXS9_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: asantibanez
name: 'Andrés Santibáñez'
avatar: 'https://pbs.twimg.com/profile_images/1003126488957321218/d-e02mzF_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: brendt_gd
name: Brent
avatar: 'https://pbs.twimg.com/profile_images/1425316325845504000/XEnr-h2a_normal.png'
---

View file

@ -0,0 +1,5 @@
---
username: cosmeescobedo
name: 'Cosme Escobedo'
avatar: 'https://pbs.twimg.com/profile_images/1491156731203710979/T0DNLMns_normal.jpg'
---

View file

@ -1,5 +1,5 @@
---
username: freekmurze
avatar: 'https://pbs.twimg.com/profile_images/1492514213381746692/DARB_SUs_normal.jpg'
name: 'Freek Van der Herten 🔭'
avatar: 'https://pbs.twimg.com/profile_images/1433390470965735424/f5UiMISj_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: jasonlbeggs
name: 'Jason Beggs'
avatar: 'https://pbs.twimg.com/profile_images/1391946980960743425/xi3nDA3k_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: warsh33p
name: 'Kai Sassnowski 🥔'
avatar: 'https://pbs.twimg.com/profile_images/1471470755355443210/pCy5acDI_normal.jpg'
---

View file

@ -0,0 +1,11 @@
---
slug: weekly-thread-2022-05
title: 'Weekly thread #05 of 2022'
tweet_id: '1489620159585153026'
author_username: archtechx
created_at: 2022-02-04T21:42:06+00:00
links: { }
---
🔥 This week's code tips for Laravel developers
A weekly thread 🧵

View file

@ -0,0 +1,13 @@
---
slug: weekly-thread-2022-06
title: 'Weekly thread #06 of 2022'
tweet_id: '1494019542648901632'
author_username: archtechx
created_at: 2022-02-16T18:44:38+00:00
links: { }
---
🔥 Last week's code tips for Laravel developers
A weekly thread 🧵
https://twitter.com/archtechx/status/1493663801715081221

View file

@ -0,0 +1,11 @@
---
slug: weekly-thread-2022-07
title: 'Weekly thread #07 of 2022'
tweet_id: '1495414929053995012'
author_username: archtechx
created_at: 2022-02-20T15:07:57+00:00
links: { }
---
🔥 This week's code tips for Laravel developers
A weekly thread 🧵

View file

@ -0,0 +1,11 @@
---
title: 'In Laravel 9, you can use str() instead of Str::of()'
tweet_id: '1494019557249335296'
thread_slug: weekly-thread-2022-06
author_username: jasonlbeggs
images:
- 'https://pbs.twimg.com/media/FLKjhn4XMAIZqNI.png'
created_at: 2022-02-16T18:43:14+00:00
slug: in-laravel-9-you-can-use-str-instead-of-strof
---
The `str` helper in @laravelphp v9 is 🔥

View file

@ -0,0 +1,13 @@
---
title: 'Laravel 9 can automatically bind route parameters to enums'
tweet_id: '1494019551310139392'
thread_slug: weekly-thread-2022-06
author_username: mmartin_joo
images:
- 'https://pbs.twimg.com/media/FLJ8Gt_XsAM98uy.jpg'
created_at: 2022-02-16T18:43:13+00:00
slug: laravel-9-can-automatically-bind-route-parameters-to-enums
---
🔥Laravel 9 introduced enum route bindings!
You can type-hint your enum and Laravel will cast the string value from the URL:

View file

@ -0,0 +1,17 @@
---
title: 'Laravel provides a `Fluent` class as a universal structure for array data'
tweet_id: '1489620180086902792'
thread_slug: weekly-thread-2022-05
author_username: cerbero90
images:
- 'https://pbs.twimg.com/media/FKcMWbwacAICnCw.png'
created_at: 2022-02-04T15:21:41+00:00
slug: laravel-provides-a-fluent-class-as-a-universal-structure-for-array-data
---
Fluent is a utility class provided by @laravelphp that lets us handle data fluently.
Out of the box it can be turned into an array or JSON, it can act as an array and it's serializable as a JSON.
It also gets and sets attributes dynamically and in a fluent way.
#Laravel #PHP

View file

@ -0,0 +1,15 @@
---
title: 'match() statements are a great way to clean up code'
tweet_id: '1489620168233734144'
thread_slug: weekly-thread-2022-05
author_username: cerbero90
images:
- 'https://pbs.twimg.com/media/FKqzQ68aMAAqGdX.png'
created_at: 2022-02-04T15:21:38+00:00
slug: match-statements-are-a-great-way-to-clean-up-code
---
Match offers such a compact and clean syntax compared to its PHP alternatives 🌈
It can make our code way more readable and concise 💅
#PHP

View file

@ -0,0 +1,11 @@
---
title: 'Move tests to separate test suites'
tweet_id: '1495414937757253636'
thread_slug: weekly-thread-2022-07
author_username: JackEllis
images:
- 'https://pbs.twimg.com/media/FLVuSJRVQAEQffe.jpg'
created_at: 2022-02-20T15:07:59+00:00
slug: move-tests-to-separate-test-suites
---
My Laravel tip of the day. If you're running slow tests that need to hit a third party API, you can break them out of your Features directory and put them in a dedicated test suite (e.g. External). Then you can run "phpunit --testsuite Feature", and your External tests won't run.

View file

@ -0,0 +1,15 @@
---
title: 'Name contracts as descriptors and implementations as orders'
tweet_id: '1494019563490402305'
thread_slug: weekly-thread-2022-06
author_username: MikeVILT
images:
- 'https://pbs.twimg.com/media/FLKZjZbXMAQ18WD.jpg'
created_at: 2022-02-16T18:43:16+00:00
slug: name-contracts-as-descriptors-and-implementations-as-orders
---
A great tip from Luke @LukeDowning19,
"Name contracts as descriptions and implementations as orders"
#laracon

View file

@ -0,0 +1,16 @@
---
title: 'Specify container bindings using the $bindings array'
tweet_id: '1494019548374126594'
thread_slug: weekly-thread-2022-06
author_username: freekmurze
images:
- 'https://pbs.twimg.com/media/FLKZmOCWYAAq9Hd.jpg'
created_at: 2022-02-16T18:43:12+00:00
slug: specify-container-bindings-using-the-bindings-array
---
🔥 Cool tidbit I learned during @LukeDowning19 s talk.
You can add a `$bindings` array to a service provider to bind things.
https://laravel.com/docs/9.x/providers#the-bindings-and-singletons-properties
#laravel #php

View file

@ -0,0 +1,11 @@
---
title: 'Use comments for explaining complex logic'
tweet_id: '1495414946556903424'
thread_slug: weekly-thread-2022-07
author_username: brendt_gd
images:
- 'https://pbs.twimg.com/media/FLsw0t6XwAIe5aI.jpg'
created_at: 2022-02-20T15:08:01+00:00
slug: use-comments-for-explaining-complex-logic
---
Comments in code should be used with care. They should only be added when they add actual value to the programmer; which is why I style them in such a way that they "pop out", instead of them disappearing in the background.

View file

@ -0,0 +1,11 @@
---
title: 'Use Faker::numerify() to create strings with numbers at specific places'
tweet_id: '1495414931788746755'
thread_slug: weekly-thread-2022-07
author_username: SteveTheBauman
images:
- 'https://pbs.twimg.com/media/FLkESRpXIAwj769.jpg'
created_at: 2022-02-20T15:07:57+00:00
slug: use-fakernumerify-to-create-strings-with-numbers-at-specific-places
---
A quick one that I *always* forget about -- Faker::numerify, allowing you to generate numeric data in a specific pattern 👌👏

View file

@ -0,0 +1,13 @@
---
title: 'Use the policy() helper to resolve a policy for a model'
tweet_id: '1494019545446567939'
thread_slug: weekly-thread-2022-06
author_username: asantibanez
images:
- 'https://pbs.twimg.com/media/FLNAs-bXIAExJxr.jpg'
created_at: 2022-02-16T18:43:11+00:00
slug: use-the-policy-helper-to-resolve-a-policy-for-a-model
---
TIL about @laravelphp policy() helper. Give it a model and it will resolve the policy for you.
Very useful when testing policies behavior. 💪

View file

@ -0,0 +1,11 @@
---
title: 'You can add this Tailwind plugin to generate child-selector variants'
tweet_id: '1489620177071210497'
thread_slug: weekly-thread-2022-05
author_username: warsh33p
images:
- 'https://pbs.twimg.com/media/FKaHaf9XsAQzC_0.jpg'
created_at: 2022-02-04T15:21:40+00:00
slug: you-can-add-this-tailwind-plugin-to-generate-child-selector-variants
---
🔥 Since Im having to deal with a lot of generated markup recently, this small child-selector plugin for Tailwind has been a life saver.

View file

@ -0,0 +1,11 @@
---
title: 'You can conditionally skip() scheduled jobs'
tweet_id: '1495414940684804100'
thread_slug: weekly-thread-2022-07
author_username: cosmeescobedo
images:
- 'https://pbs.twimg.com/media/FL2KtKzVgAABGiG.jpg'
created_at: 2022-02-20T15:07:59+00:00
slug: you-can-conditionally-skip-scheduled-jobs
---
🔥 #Laravel the skip method in scheduler

View file

@ -0,0 +1,11 @@
---
title: 'You can disable lazy loading using Model::preventLazyLoading()'
tweet_id: '1489620165201330177'
thread_slug: weekly-thread-2022-05
author_username: mattkingshott
images:
- 'https://pbs.twimg.com/media/FKlnRQ_XwAUqAxB.jpg'
created_at: 2022-02-04T15:21:37+00:00
slug: you-can-disable-lazy-loading-using-modelpreventlazyloading
---
🔥 #Laravel Tip: Protect your database from the dangers of lazy loading by disabling it in your Laravel app. You can also customise how violations are handled, which is perfect for models outside of your control e.g. within packages.

View file

@ -0,0 +1,11 @@
---
title: 'You can replace Laravel''s stubs to customize files generated using artisan commands'
tweet_id: '1489620183085768706'
thread_slug: weekly-thread-2022-05
author_username: mattkingshott
images:
- 'https://pbs.twimg.com/media/FKbBGYpXIAACsW8.jpg'
created_at: 2022-02-04T15:21:42+00:00
slug: you-can-replace-laravels-stubs-to-customize-files-generated-using-artisan-commands
---
🔥 #Laravel Tip: If you find yourself constantly making changes to new files generated by Artisan's 'make' commands, then consider publishing the stubs and creating your own defaults. It can be a real time saver:

View file

@ -0,0 +1,15 @@
---
title: 'You can skip() TransformRequests-type middleware'
tweet_id: '1494019554304880641'
thread_slug: weekly-thread-2022-06
author_username: pascalbaljet
images:
- 'https://pbs.twimg.com/media/FKwygqPWQAMRaTr.jpg'
created_at: 2022-02-16T18:43:13+00:00
slug: you-can-skip-transformrequests-type-middleware
---
💡 As of @laravelphp v8.36.0, you can skip 'TransformRequests' middlewares by registering a callback.
For example, you can use it on 'TrimStrings' and 'ConvertEmptyStringsToNull'.
#Laravel #PHP #webdev

View file

@ -0,0 +1,13 @@
---
title: 'You can swap multiple keywords in a string using this macro'
tweet_id: '1489620174093176833'
thread_slug: weekly-thread-2022-05
author_username: aarondfrancis
images:
- 'https://pbs.twimg.com/media/FKd_FZRXsAEgBjK.jpg'
created_at: 2022-02-04T15:21:39+00:00
slug: you-can-swap-multiple-keywords-in-a-string-using-this-macro
---
This is one of those macros I carry around from project to project.
Super clear, super easy, nice little life improvement.

View file

@ -0,0 +1,11 @@
---
title: 'You can track logins and logouts for auditing purposes using Laravel''s native auth events'
tweet_id: '1489620171241050112'
thread_slug: weekly-thread-2022-05
author_username: mattkingshott
images:
- 'https://pbs.twimg.com/media/FKlsjn1WQAU_Xg2.jpg'
created_at: 2022-02-04T15:21:39+00:00
slug: you-can-track-logins-and-logouts-for-auditing-purposes-using-laravels-native-auth-events
---
🔥 #Laravel Tip: Tracking logins and logouts for auditing or security purposes is incredibly easy thanks to Laravels login and logout events. Simply listen for them in a service provider and respond when they are fired.

View file

@ -0,0 +1,15 @@
---
title: 'You can use the @checked Blade directive to generate checked="" markup'
tweet_id: '1494019560223096837'
thread_slug: weekly-thread-2022-06
author_username: AshAllenDesign
images:
- 'https://pbs.twimg.com/media/FKwA95pWUAInwgf.jpg'
created_at: 2022-02-16T18:43:15+00:00
slug: you-can-use-the-at-checked-blade-directive-to-generate-checked-markup
---
🔥 In Laravel 9, you'll be able to use the cool new "checked" Blade directive.
This is going to be a nice addition that we can use to clean up our Blade views a little bit
#laravel #php

View file

@ -0,0 +1,11 @@
---
title: 'You can use the getCollection() and setCollection() methods on the paginator to interact with the underlying data'
tweet_id: '1489620186109857800'
thread_slug: weekly-thread-2022-05
author_username: alanrezende
images:
- 'https://pbs.twimg.com/media/FKngV3LWQAQcft4.png'
created_at: 2022-02-04T15:21:42+00:00
slug: you-can-use-the-getcollection-and-setcollection-methods-on-the-paginator-to-interact-with-the-underlying-data
---
🔥 #Laravel paginator tip: you can use getCollection and setCollection if you need to do something to the paginator underlying data. Trust me you'll know when you need this.

View file

@ -0,0 +1,13 @@
---
title: 'You can use the new Str::transliterate() helper to convert a string to its closest ASCII representation'
tweet_id: '1489620162357579778'
thread_slug: weekly-thread-2022-05
author_username: freekmurze
images:
- 'https://pbs.twimg.com/media/FKmRs46XsAA85Bh.jpg'
created_at: 2022-02-04T15:21:37+00:00
slug: you-can-use-the-new-strtransliterate-helper-to-convert-a-string-to-its-closest-ascii-representation
---
Pretty cool string helper method
https://laravel-news.com/laravel-8-82-0
#laravel #php

View file

@ -0,0 +1,13 @@
---
title: 'You can use traits inside PHP enums'
tweet_id: '1495414934754136064'
thread_slug: weekly-thread-2022-07
author_username: archtechx
images:
- 'https://pbs.twimg.com/media/FL_ee0mVgAUuD-u.jpg'
created_at: 2022-02-20T15:07:58+00:00
slug: you-can-use-traits-inside-php-enums
---
A few days ago, I learned that PHP enums can use traits
It may seem like a massive anti-pattern, but it allows making enums actually awesome with this one trick 🔥

View file

@ -0,0 +1,11 @@
---
title: 'You can use whereNumber() on routes instead of passing a regex pattern to where()'
tweet_id: '1495414943612506113'
thread_slug: weekly-thread-2022-07
author_username: Sileence
images:
- 'https://pbs.twimg.com/media/FLZ9iNEX0AcKQVD.jpg'
created_at: 2022-02-20T15:08:00+00:00
slug: you-can-use-wherenumber-on-routes-instead-of-passing-a-regex-pattern-to-where
---
I'm reading the Laravel 9 docs from scratch and TIL you can write your route restrictions in a more expressive way: