├── .DS_Store ├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── .styleci.yml ├── README.md ├── app ├── Console │ ├── Commands │ │ ├── AddTweet.php │ │ ├── GenerateHtml.php │ │ └── WeeklyThread.php │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ └── Controller.php │ ├── Kernel.php │ └── Middleware │ │ ├── Authenticate.php │ │ ├── EncryptCookies.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── TrustProxies.php │ │ └── VerifyCsrfToken.php ├── MarkdownCompiler.php ├── Models │ ├── Author.php │ ├── Thread.php │ └── Tip.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php └── Twitter │ ├── Tweet.php │ ├── TwitterImage.php │ └── TwitterUser.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── cors.php ├── database.php ├── filesystems.php ├── hashing.php ├── logging.php ├── mail.php ├── orbit.php ├── queue.php ├── services.php ├── session.php └── view.php ├── content ├── authors │ ├── AshAllenDesign.md │ ├── AzizullahSamim.md │ ├── BurtDS.md │ ├── DanSysAnalyst.md │ ├── DianaWebdev.md │ ├── JackEllis.md │ ├── JuanDMeGon.md │ ├── JustinBTechGuy.md │ ├── LarsKlopstra.md │ ├── LiamHammett.md │ ├── LupinityLabs.md │ ├── MikeVILT.md │ ├── Philo01.md │ ├── PovilasKorop.md │ ├── RBilloir.md │ ├── Sileence.md │ ├── SteveTheBauman.md │ ├── aarondfrancis.md │ ├── abrardev99.md │ ├── alanrezende.md │ ├── alexjgarrett.md │ ├── anwar_nairi.md │ ├── archtechx.md │ ├── asantibanez.md │ ├── aschmelyun.md │ ├── austencam.md │ ├── avosalmon.md │ ├── bhaidar.md │ ├── bobbybouwmann.md │ ├── bradyrenting.md │ ├── brendt_gd.md │ ├── carre_sam.md │ ├── cerbero90.md │ ├── cosmeescobedo.md │ ├── danjharrin.md │ ├── djgeisi.md │ ├── doekenorg.md │ ├── ecrmnn.md │ ├── enunomaduro.md │ ├── fideloper.md │ ├── frankdejonge.md │ ├── freekmurze.md │ ├── iamharis010.md │ ├── itsmarkmead.md │ ├── jasonlbeggs.md │ ├── jbrooksuk.md │ ├── jessarchercodes.md │ ├── joemasilotti.md │ ├── jordankdalton.md │ ├── justsanjit.md │ ├── laracasts.md │ ├── laravelnews.md │ ├── marcelpociot.md │ ├── mattkingshott.md │ ├── mmartin_joo.md │ ├── morrislaptop.md │ ├── mvpopuk.md │ ├── nuernberger_me.md │ ├── pascalbaljet.md │ ├── realstevebauman.md │ ├── reinink.md │ ├── ryangjchandler.md │ ├── samuelstancl.md │ ├── sebdedeyne.md │ ├── sharik_709.md │ ├── sky_0xs.md │ ├── taylorotwell.md │ ├── timacdonald87.md │ ├── tobias_petry.md │ ├── victoryoalli.md │ ├── warsh33p.md │ ├── xiCO2k.md │ └── zepfietje.md ├── threads │ ├── 1-rt-1-tip.md │ ├── laravel-clean-code-tactics.md │ ├── obscure-livewire-tips.md │ ├── pest-tips.md │ ├── weekly-thread-2021-42.md │ ├── weekly-thread-2021-43.md │ ├── weekly-thread-2021-44.md │ ├── weekly-thread-2021-45.md │ ├── weekly-thread-2021-46.md │ ├── weekly-thread-2021-47.md │ ├── weekly-thread-2021-48.md │ ├── weekly-thread-2021-49.md │ ├── weekly-thread-2021-50.md │ ├── weekly-thread-2022-01.md │ ├── weekly-thread-2022-02.md │ ├── weekly-thread-2022-03.md │ ├── weekly-thread-2022-04.md │ ├── weekly-thread-2022-05.md │ ├── weekly-thread-2022-06.md │ ├── weekly-thread-2022-07.md │ ├── weekly-thread-2022-08.md │ ├── weekly-thread-2022-09.md │ ├── weekly-thread-2022-10.md │ ├── weekly-thread-2022-11.md │ ├── weekly-thread-2022-12.md │ ├── weekly-thread-2022-13.md │ ├── weekly-thread-2022-14.md │ ├── weekly-thread-2022-15.md │ ├── weekly-thread-2022-16.md │ ├── weekly-thread-2022-17.md │ ├── weekly-thread-2022-20.md │ ├── weekly-thread-2022-21.md │ ├── weekly-thread-2022-22.md │ ├── weekly-thread-2022-24.md │ ├── weekly-thread-2022-25.md │ ├── weekly-thread-2022-26.md │ ├── weekly-thread-2022-27.md │ ├── weekly-thread-2022-28.md │ ├── weekly-thread-2022-29.md │ ├── weekly-thread-2022-30.md │ ├── weekly-thread-2022-31.md │ └── weekly-thread-2022-35.md └── tips │ ├── add-a-recursive-macro-to-convert-an-array-including-its-children-to-collections.md │ ├── adding-where-scopes-which-use-an-indexed-column-to-a-query-thats-primarily-filtered-by-another-column-is-a-great-way-to-speed-up-db-performance.md │ ├── advanced-notifications.md │ ├── advanced-trait-design.md │ ├── array-destructuring-in-php-is-very-powerful-yet-still-underutilized.md │ ├── avoid-helper-classes.md │ ├── avoid-queries-in-blade-when-possible.md │ ├── be-careful-about-setting-timezones-with-carbon.md │ ├── be-careful-if-youre-not-scoping-your-route-model-bindings.md │ ├── be-friends-with-your-ide.md │ ├── blades-at-class-directive-can-significantly-clean-up-your-templates.md │ ├── call-methods-from-javascript.md │ ├── class-constructor-property-promotion-pairs-extremely-well-with-dtos.md │ ├── class-you-can-use-the-at-env-blade-directive-to-render-stuff-only-in-a-given-environment.md │ ├── closure-validation-rules-are-theyre-often-better-than-creating-a-class-just-for-a-single-use.md │ ├── compare-models-using-is-instead-of-directly-comparing-attributes.md │ ├── comparing-changes-on-saving-using.md │ ├── compose-components-using-traits.md │ ├── consider-creating-helpers-for-model-factories.md │ ├── consider-single-action-controllers.md │ ├── consider-using-form-requests.md │ ├── consider-using-helpers-instead-of-facades-they-can-clean-things-up.md │ ├── consider-using-mb-functions-when-working-with-localized-strings.md │ ├── context-matters.md │ ├── controllers-can-be-used-as-route-groups.md │ ├── convert-email-addresses-to-full-names-with-the-help-of-strheadline.md │ ├── create-a-using-helper-in-pest.md │ ├── create-action-classes.md │ ├── create-an-attempt-helper-for-calls-that-can-silently-fail.md │ ├── create-custom-blade-directives-for-business-logic.md │ ├── create-fluent-objects.md │ ├── create-helper-functions-for-creating-models-in-tests-using-factories.md │ ├── create-helper-functions.md │ ├── create-methods-for-complex-conditionals.md │ ├── create-model-methods-for-business-logic.md │ ├── create-query-scopes-for-complex-wheres.md │ ├── create-renderable-exceptions.md │ ├── create-single-use-blade-includes.md │ ├── create-single-use-traits.md │ ├── create-subscribers-to-listen-to-amp-handle-multiple-events-using-separate-methods-inside-a-single-class.md │ ├── create-this-tinker-bash-script-to-supercharge-your-dev-workflow.md │ ├── create-traits-for-relationships-you-commonly-use-in-your-models-to-make-your-codebase-cleaner-simpler-and-more-consistent.md │ ├── create-variables-when-they-improve-readability.md │ ├── custom-collections-pair-well-with-higher-order-proxies.md │ ├── custom-response-effects.md │ ├── customize-the-page-that-users-are-redirected-to-after-registration-by-changing-a-value-in-the-fortify-config.md │ ├── databases-can-generate-random-uuid-keys.md │ ├── dedicate-a-weekend-towards-learning-proper-oop.md │ ├── dont-create-variables-when-you-can-just-pass-the-value-directly.md │ ├── dont-just-write-procedural-code-in-classes.md │ ├── dont-split-lines-at-random-places-but-dont-make-them-too-long-either.md │ ├── dont-use-a-controller-namespace.md │ ├── dont-use-abbreviations.md │ ├── dont-use-model-methods-to-retrieve-data.md │ ├── dump-and-dd-are-available-on-the-eloquent-query-builder.md │ ├── eloquent-listeners-are-awesome.md │ ├── encrypted-casts-can-use-unique-model-derived-keys.md │ ├── example-checking-a-parent-relationship-for-some-things.md │ ├── example-deleting-associated-files-on-deletion.md │ ├── extract-methods.md │ ├── form-elements-can-have-a-target-attribute-which-works-very-similarly-to-ltagt-tags.md │ ├── from-php-74-you-can-use-the-spread-syntax-to-merge-arrays.md │ ├── have-a-single-source-of-truth-for-validation-rules.md │ ├── heres-another-example-of-the-model-state-stuff-mentioned-above.md │ ├── higher-order-messages-are-a-great-way-to-tidy-up-long-collection-logic.md │ ├── http-response-status-can-be-customized-when-denying-actions-via-gates-amp-policies.md │ ├── if-you-didnt-know-at-laravellivewire-now-triggers-updated-and-updating-hooks-for-nested-properties-which-works-with-both-array-and-model-properties.md │ ├── if-you-dont-like-the-double-indentation-of-vue-data-you-can-use-arrow-functions.md │ ├── if-you-use-both-pest-and-phpunit-you-can-use-both-syntaxes-in-both-types-of-tests.md │ ├── if-you-want-to-identify-teams-workspaces-etc-by-path-you-dont-have-to-pass-the-team-id-to-every-route.md │ ├── if-youre-debugging-your-app-and-youd-like-to-examine-more-things-eg-the-stack-trace-executed-queries-app-context.md │ ├── if-youre-returning-class-names-as-opposed-to-instances-you-can-use-the-class-name-docblock.md │ ├── implement-the-tostring-method-in-a-class-to-specify-custom-logic-for-converting-its-instances-to-strings.md │ ├── import-namespaces-instead-of-using-aliases.md │ ├── improve-the-dx-of-your-commands-by-making-arguments-optional-and-prompting-the-user-when-theyre-empty.md │ ├── in-laravel-9-you-can-use-str-instead-of-strof.md │ ├── in-scheduled-tasks-you-can-use-onsuccess-and-onfailure-callbacks.md │ ├── including-a-unique-value-like-now-or-strrandom-in-the-blade-template-of-a-livewire-component-is-a-great-way-to-check-if-that-part-of-the-dom-is-getting-re-rendered.md │ ├── instead-of-writing-repetitive-else-if-statements-use-an-array-to-look-up-the-wanted-value-based-on-the-key-you-have.md │ ├── interesting-technique-add-getters-to-form-requests.md │ ├── isset-accepts-multiple-arguments.md │ ├── its-about-the-micro.md │ ├── keep-validation-rules-inside-models-to-make-your-code-more-consistent-and-clean.md │ ├── laravel-9-can-automatically-bind-route-parameters-to-enums.md │ ├── laravel-can-automatically-notify-you-by-email-when-a-scheduled-job-fails.md │ ├── laravel-migrations-have-a-very-nice-syntax-for-foreign-keys.md │ ├── laravel-nova-lets-you-show-different-resourcestoolscards-based-on-an-if-check.md │ ├── laravel-provides-a-fluent-class-as-a-universal-structure-for-array-data.md │ ├── laravel-telescope-is-great-for-so-many-things.md │ ├── laravels-container-can-be-used-for-resolving-variadic-dependencies.md │ ├── laravels-http-client-lets-you-easily-define-retry-attempts-and-a-timeout.md │ ├── laravels-http-client-supports-concurrent-requests-using-the-pool-method.md │ ├── laravels-ratelimiter-can-be-used-to-throttle-any-parts-of-your-code.md │ ├── laravels-slack-logging-channel-is-fully-compatible-with-discord.md │ ├── livewire-readonly-properties.md │ ├── long-classes-can-be-split-into-small-single-use-traits.md │ ├── make-laravel-send-all-emails-to-a-specific-email-address-using-mailalwaysto.md │ ├── make-models-prunable-to-periodically-delete-them-from-the-db.md │ ├── match-statements-are-a-great-way-to-clean-up-code.md │ ├── method-parameters-can-be-marked-as-sensitive.md │ ├── move-tests-to-separate-test-suites.md │ ├── mysql-has-a-blackhole-store-engine.md │ ├── name-all-timestamp-fields-using-the-action-at-convention.md │ ├── name-contracts-as-descriptors-and-implementations-as-orders.md │ ├── number-markdown-lists-with-1-rather-than-the-actual-number.md │ ├── orderbyraw-is-very-useful-for-complex-sorting-in-eloquent.md │ ├── partial-indexes-are-useful-for-enforcing-rules-that-only-apply-conditionally.md │ ├── people-underutilize-the-exception-handler.md │ ├── pest-allows-calling-dd-directly-on-the-expect-chain.md │ ├── php-81-enums-can-be-used-as-model-casts.md │ ├── php-traits-can-contain-abstract-methods.md │ ├── put-migration-names-in-quotes-when-running-makemigration.md │ ├── ratelimiters-attempt-accepts-a-fourth-parameter-for-the-decay.md │ ├── relevant-for-people-building-packages.md │ ├── replace-state-with-a-custom-directive.md │ ├── rows-can-be-stored-in-an-already-sorted-way-instead-of-the-default-insertion-order.md │ ├── share-state-using-sprucewire.md │ ├── specify-container-bindings-using-the-bindings-array.md │ ├── specify-the-columns-you-want-to-select-when-fetching-all-models.md │ ├── str-gtplural-lets-you-convert-words-to-their-right-form-based-on-a-provided-amount.md │ ├── string-ids-can-be-case-sensitive.md │ ├── strmask-lets-you-mask-a-portion-of-a-string-with-a-character-eg.md │ ├── the-latestofmany-method-lets-you-use-a-hasmany-relation-as-a-hasone-relation-returning-the-latest-record.md │ ├── the-order-of-columns-in-multi-column-indices-matters.md │ ├── the-shouldcache-method-lets-you-cache-model-accessor-values.md │ ├── the-spread-syntax-understands-named-parameters-and-correctly-assigns-array-values-to-them.md │ ├── the-value-helper-returns-the-passed-value-unless-its-invokable-then-it-first-calls-it.md │ ├── there-are-multiple-ways-to-redirect-users.md │ ├── theres-great-value-in-understanding-how-object-state-of-models-works-this-is-mostly-relevant-in-feature-tests-because-they-touch-many-parts-of-your-codebase-in-one-phplaravel-app-state.md │ ├── this-one-is-less-obscure.md │ ├── this-pattern-is-brilliant-and-can-make-your-code-much-more-clean-and-consistent.md │ ├── this-wont-fit-into-one-tweet-but-theres-so-much-cool-stuff-you-can-do-with-eloquent.md │ ├── try-to-avoid-unnecessary-nesting-by-returning-a-value-early.md │ ├── understand-the-difference-between-fresh-and-refresh-one-returns-a-fresh-new-instance-while-the-other-refreshes-an-existing-instance.md │ ├── uploaded-files-can-be-attached-to-emails-directly-from-the-request.md │ ├── use-aggregate-methods-to-count-related-models.md │ ├── use-appends-to-include-properties-in-the-array-representation-of-your-model.md │ ├── use-carbons-settimezone-and-shifttimezone-methods.md │ ├── use-collections-when-they-can-clean-up-your-code.md │ ├── use-comments-for-explaining-complex-logic.md │ ├── use-common-table-expressions-to-refine-your-data-in-complex-eloquent-queries.md │ ├── use-composer-outdated-direct-to-view-outdated-dependencies-of-your-app.md │ ├── use-composer-why-not-to-see-why-a-dependency-cannot-be-installed.md │ ├── use-constructor-property-promotion-to-define-class-properties-directly-on-the-constructor.md │ ├── use-custom-collections.md │ ├── use-custom-config-files.md │ ├── use-data-transfer-objects-dtos.md │ ├── use-database-partitions-to-delete-large-chunks-of-data-efficiently.md │ ├── use-declarestrict-types1-to-enable-strict-mode-for-type-checking.md │ ├── use-docblocks-only-when-they-clarify-things.md │ ├── use-eloquent-scopes-to-clean-up-complex-relation-queries.md │ ├── use-events.md │ ├── use-explicit-null-handling-in-your-db-queries-when-filtering-for-rows-with-empty-value-in-a-nullable-column.md │ ├── use-expressive-names-for-methods.md │ ├── use-fakernumerify-to-create-strings-with-numbers-at-specific-places.md │ ├── use-laravels-task-scheduler-to-run-cli-commands-including-shell-scripts-at-regular-intervals.md │ ├── use-match-or-switch-statements-to-conditionally-scope-database-queries-based-on-query-strings-in-the-request.md │ ├── use-not-to-reverse-an-assertion-in-pestphp.md │ ├── use-on-demand-notifications-to-send-messages-to-unregistered-users.md │ ├── use-partitions-for-deleting-mass-amounts-of-data.md │ ├── use-postgresqls-trigram-indexes-to-make-where-like-queries-faster.md │ ├── use-prefetching-to-boost-the-perceived-speed-of-livewire-apps.md │ ├── use-retry-for-callbacks-that-may-randomly-fail.md │ ├── use-short-operators.md │ ├── use-skip-when-writing-tests-ahead-of-time.md │ ├── use-strict-comparison.md │ ├── use-tailwinds-color-opacity-modifier-to-change-the-background-color-and-opacity-in-a-single-class.md │ ├── use-tap-to-do-something-with-the-object-and-immediately-return-it.md │ ├── use-test-files-to-describe-your-thoughts-about-a-specific-feature-in-full-before-starting-implementation.md │ ├── use-the-aftermaking-or-aftercreating-hooks-in-factories-to-execute-additional-logic.md │ ├── use-the-app-gtterminating-hook-to-perform-tasks-after-the-response-has-been-sent-to-the-user.md │ ├── use-the-loop-variable-in-blade-foreach-loops-to-access-metadata-about-the-loop.md │ ├── use-the-nullordelete-method-in-your-relationship-column-definitions-to-clear-their-value-when-the-parent-record-gets-deleted.md │ ├── use-the-policy-helper-to-resolve-a-policy-for-a-model.md │ ├── use-the-quietly-methods-to-create-models-without-firing-events-using-your-factories.md │ ├── use-the-requests-flag-when-creating-models-to-also-create-form-requests.md │ ├── use-the-reset-method-to-reset-properties-to-their-original-state-in-livewire.md │ ├── use-the-shouldbeencrypted-interface-on-a-job-class-to-make-laravel-encrypt-the-jobs-payload.md │ ├── use-the-something-at-convention-instead-of-is-something-in-your-table-definitions.md │ ├── use-the-soundex-function-in-mysql-to-compare-strings-by-how-they-sound-rather-than-how-theyre-typed.md │ ├── use-the-stream-method-to-send-a-file-to-the-browser-without-triggering-a-download.md │ ├── use-the-strheadline-method-to-convert-strings-to-studly-words.md │ ├── use-the-touches-property-to-update-the-parent-timestamp-when-a-child-is-updated.md │ ├── use-the-updateexistingpivot-method-to-make-changes-to-pivot-columns-on-existing-records.md │ ├── use-the-with-ties-clause-to-return-more-than-the-limit-ed-amount-when-there-are-multiple-results-with-the-same-value.md │ ├── use-the-withaggregate-method-to-add-related-values-to-eloquent-queries-using-subselects.md │ ├── use-to-use-alpine-property-binding-inside-blade-templates.md │ ├── use-typehints-wherever-possible-to-improve-code-safety-and-ide-support.md │ ├── use-wherebelongsto-and-relation-is-instead-of-comparing-ids-manually.md │ ├── use-wire-entangle-instead-of-entangle.md │ ├── use-wire-replace.md │ ├── use-wireentangle-instead-of-entangle.md │ ├── using-small-integers-instead-of-entire-class-strings-for-morph-relations-can-improve-their-performance.md │ ├── wanna-update-a-set-of-eloquent-models-and-have-the-change-updated-in-the-database-and-in-your-in-memory-instances-but-dont-wanna-incur-a-database-query-for-each-model.md │ ├── when-a-relationship-is-already-loaded-and-cached-on-the-model-instance-youll-have-to-refresh-it.md │ ├── when-creating-jobs-only-accept-the-needed-data.md │ ├── when-im-converting-data-into-a-different-structure-one-thing-i-like-to-do-is-annotate-how-the-structure-looks-at-each-point-of-the-process.md │ ├── write-functional-code-when-it-benefits-you.md │ ├── writing-simple-page-can-be-visited-tests-is-a-great-way-to-get-started-with-testing.md │ ├── yesterday-in-my-at-laracononline-talk-i-explained-how-to-use-the-query-builder-when-method-to-handle-complex-sorting.md │ ├── you-can-add-a-messages-method-to-form-requests-to-customize-their-validation-error-messages.md │ ├── you-can-add-a-refresh-flag-to-the-artisan-down-command-to-send-a-refresh-header-to-the-browser.md │ ├── you-can-add-a-tags-method-to-a-job-anything-you-return-from-this-method-will-be-displayed-in-horizon.md │ ├── you-can-add-a-uri-fragment-when-redirecting-to-a-route.md │ ├── you-can-add-temporaryurl-to-any-storage-driver.md │ ├── you-can-add-the-context-and-render-methods-to-custom-exceptions.md │ ├── you-can-add-the-prunable-trait-to-soft-delete-models-from-the-database-but-only-remove-them-permanently-after-a-few-days.md │ ├── you-can-add-this-tailwind-plugin-to-generate-child-selector-variants.md │ ├── you-can-assert-that-a-job-will-be-deleted-from-the-queue.md │ ├── you-can-associate-an-input-with-a-form-using-the-form-attribute.md │ ├── you-can-avoid-many-n1-issues-by-using-lateral-joins-in-mysql.md │ ├── you-can-calculate-multiple-aggregates-in-a-single-database-query.md │ ├── you-can-calculate-the-age-of-carbon-instances.md │ ├── you-can-call-squish-on-stringable-instances-to-remove-all-unnecessary-whitespaces.md │ ├── you-can-call-withtrashed-on-a-route-to-accept-soft-deleted-models.md │ ├── you-can-chain-can-to-route-definitions-to-specify-policy-rules.md │ ├── you-can-check-if-a-string-contains-json-by-decoding-it-encoding-it-again-and-comparing-the-value-with-the-original.md │ ├── you-can-clear-all-laravel-caches-using-optimizeclear.md │ ├── you-can-conditionally-skip-scheduled-jobs.md │ ├── you-can-convert-an-eloquent-collection-back-to-an-eloquent-query-builder.md │ ├── you-can-convert-eloquent-collections-back-to-a-query-builder-instance.md │ ├── you-can-create-a-special-index-for-a-transformation-of-a-column.md │ ├── you-can-create-db-indices-for-transformed-versions-of-columns.md │ ├── you-can-create-dynamic-relationships-this-relationship-is-based-on-a-column-thats-added-using-a-subquery-in-a-scope.md │ ├── you-can-create-storage-disks-on-the-fly.md │ ├── you-can-create-text-based-tables-in-laravel-even-outside-cli-commands.md │ ├── you-can-customize-default-validation-rules-for-passwords.md │ ├── you-can-debounce-a-function-using-alpinedebounce.md │ ├── you-can-define-casts-for-specific-eloquent-queries.md │ ├── you-can-define-default-model-data-for-belongsto-relationships.md │ ├── you-can-disable-lazy-loading-using-modelpreventlazyloading.md │ ├── you-can-dynamically-create-and-extend-interfaces-in-php.md │ ├── you-can-eager-load-nested-relations-using-clean-array-syntax.md │ ├── you-can-echo-backed-enums-in-blade.md │ ├── you-can-enable-js-sourcemaps-using-at-vite-js-in-laravel.md │ ├── you-can-explicitly-bind-objects-to-routes-you-dont-have-to-use-route-model-binding-only-custom-objects-work-perfectly-well-too.md │ ├── you-can-freeze-time-in-tests.md │ ├── you-can-generate-a-series-of-dates-in-a-given-range-right-at-the-database-level.md │ ├── you-can-generate-fake-images-using-faker.md │ ├── you-can-generate-fake-values-anywhere-in-your-app-using-the-new-fake-helper.md │ ├── you-can-get-all-primary-keys-from-an-eloquent-collection-using-the-modelkeys-method.md │ ├── you-can-implement-the-shouldbeencrypted-interface-on-your-jobs-to-encrypt-their-payload-before-they-get-pushed-to-the-queue.md │ ├── you-can-import-entire-namespaces-in-php.md │ ├── you-can-make-concurrent-requests-using-the-http-clients-pool-method.md │ ├── you-can-make-php-throw-an-exception-when-decoding-json-if-the-value-isnt-valid-json.md │ ├── you-can-make-the-http-client-throw-exceptions-to-terminate-execution-on-any-received-errors.md │ ├── you-can-manually-set-the-relation-of-a-model-using-setrelation-method.md │ ├── you-can-name-migrations-like-this.md │ ├── you-can-namespace-your-helper-functions.md │ ├── you-can-now-call-newline-on-stringable-instances.md │ ├── you-can-pass-a-custom-view-to-the-artisan-down-command.md │ ├── you-can-pass-parameters-to-laravel-middleware-classes.md │ ├── you-can-pass-variables-to-blade-views-using-the-withfoobar-syntax.md │ ├── you-can-process-the-output-of-scheduled-tasks-send-an-email-or-write-to-a-file.md │ ├── you-can-provide-closures-into-the-default-value-in-laravels-config-helper.md │ ├── you-can-queue-closures.md │ ├── you-can-record-all-login-logout-events.md │ ├── you-can-refactor-cluttered-if-conditions-using-lookup-tables-match-statements-and-switch-statements.md │ ├── you-can-remove-all-falsy-values-from-a-collection-by-calling-filter-without-any-arguments.md │ ├── you-can-replace-laravels-stubs-to-customize-files-generated-using-artisan-commands.md │ ├── you-can-return-custom-collections-from-eloquent-queries.md │ ├── you-can-return-false-from-a-ing-eloquent-event-listener-creating-updating-saving-deleting-to-cancel-the-action.md │ ├── you-can-return-mailables-as-responses-from-controllers-it-will-show-the-rendered-version-in-the-browser.md │ ├── you-can-run-your-tests-in-a-random-order.md │ ├── you-can-set-model-attributes-on-factories-using-the-set-method.md │ ├── you-can-show-a-link-to-the-previous-page-by-using-url-previous-in-a-blade-view.md │ ├── you-can-skip-transformrequests-type-middleware.md │ ├── you-can-start-testing-livewire-components-with-basic-tests-that-makes-sure-components-render-accurately.md │ ├── you-can-supply-default-values-for-route-parameters.md │ ├── you-can-swap-multiple-keywords-in-a-string-using-this-macro.md │ ├── you-can-temporarily-disable-an-index-by-making-it-invisible.md │ ├── you-can-temporarily-disable-timestamps-when-saving-a-model.md │ ├── you-can-time-travel-in-your-tests.md │ ├── you-can-track-logins-and-logouts-for-auditing-purposes-using-laravels-native-auth-events.md │ ├── you-can-transform-variables-passed-to-translation-strings-right-in-language-files.md │ ├── you-can-unpack-arrays-in-conditions.md │ ├── you-can-use-a-partial-index-to-enforce-uniqueness-in-tables-that-can-have-soft-deleted-records.md │ ├── you-can-use-array-annotations-to-specify-the-available-keys-and-their-value-types-in-php-arrays.md │ ├── you-can-use-at-includewhen-to-include-certain-blade-partials-when-some-condition-is-met-for-instance-when-the-current-user-is-an-admin.md │ ├── you-can-use-backticks-to-execute-a-shell-command-in-php.md │ ├── you-can-use-bladestringable-to-define-how-specific-objects-should-be-converted-to-their-string-representation.md │ ├── you-can-use-constrained-eager-loading-to-increase-performance-of-database-queries-that-use-relations.md │ ├── you-can-use-docblocks-in-blade-files-to-add-ide-support.md │ ├── you-can-use-eloquent-wherecolumn-to-compare-columns-to-each-other.md │ ├── you-can-use-eloquents-exists-method-to-check-whether-a-record-exists.md │ ├── you-can-use-factories-for-generating-any-fake-test-data-by-making-them-use-the-fluent-model.md │ ├── you-can-use-first-class-callables-for-routes-in-php-81.md │ ├── you-can-use-generic-class-string-annotations-to-hint-that-an-instance-of-the-passed-class-is-returned.md │ ├── you-can-use-giveconfig-when-using-contextual-binding.md │ ├── you-can-use-native-php-functions-like-fopen-and-fread-to-interact-directly-with-file-streams.md │ ├── you-can-use-notificationassertnothingsentto-to-check-that-no-notifications-were-sent-to-a-specific-usernotifiable-model.md │ ├── you-can-use-onerror-on-the-image-tag.md │ ├── you-can-use-partial-queue-fakes.md │ ├── you-can-use-pluck-directly-on-eloquent-classes-no-need-to-query-the-instances-first.md │ ├── you-can-use-recursive-queries-to-query-hierarchical-trees.md │ ├── you-can-use-request-whenfilled-to-execute-some-logic-only-when-a-specific-value-is-part-of-the-request-data.md │ ├── you-can-use-schema-methods-eg-table-or-create-outside-of-migrations.md │ ├── you-can-use-strmarkdown-to-build-translation-strings.md │ ├── you-can-use-ternary-operators-like-to-use-dump-or-dd-in-your-short-closures.md │ ├── you-can-use-the-array-spread-syntax-to-pass-an-array-of-arguments-to-another-function.md │ ├── you-can-use-the-at-checked-blade-directive-to-generate-checked-markup.md │ ├── you-can-use-the-at-production-blade-directive-to-load-specific-scripts-only-in-production-mode.md │ ├── you-can-use-the-boolean-date-string-methods-on-the-request-object-instead-of-manually-type-casting-request-parameters.md │ ├── you-can-use-the-data-get-method-to-safely-access-a-nested-array-value.md │ ├── you-can-use-the-date-helper-on-the-request-class-to-retrieve-a-value-as-a-carbon-instance.md │ ├── you-can-use-the-formanother-form-attribute-on-buttons-to-submit-a-different-form.md │ ├── you-can-use-the-getcollection-and-setcollection-methods-on-the-paginator-to-interact-with-the-underlying-data.md │ ├── you-can-use-the-missing-method-to-customize-404-handling-on-a-route.md │ ├── you-can-use-the-new-strtransliterate-helper-to-convert-a-string-to-its-closest-ascii-representation.md │ ├── you-can-use-the-spread-operator-to-merge-arrays-just-like-in-javascript.md │ ├── you-can-use-the-value-method-in-eloquent-to-fetch-a-single-column-from-the-db.md │ ├── you-can-use-this-gtmock-in-pest-tests.md │ ├── you-can-use-to-route-instead-of-redirect-gtroute.md │ ├── you-can-use-traits-inside-php-enums.md │ ├── you-can-use-use-wherebetween-to-filter-for-records-between-two-timestamps.md │ ├── you-can-use-usecurrent-usecurrentonupdate-on-timestamp-fields-in-your-migrations.md │ ├── you-can-use-value-to-fetch-a-single-value-from-the-database-without-having-to-instantiate-an-entire-model.md │ ├── you-can-use-valueorfail-to-fetch-a-value-from-the-database-or-abort-the-request-if-the-queried-record-does-not-exist.md │ ├── you-can-use-where-on-rule-instances-without-passing-a-callback.md │ ├── you-can-use-wherenumber-on-routes-instead-of-passing-a-regex-pattern-to-where.md │ ├── you-can-use-wherexandy-in-eloquent.md │ ├── you-can-use-with-ties-instead-of-limit-to-return-more-results-if-they-have-the-same-value.md │ ├── you-can-validate-a-field-and-exclude-it-from-the-validated-data.md │ ├── you-can-validate-data-at-the-database-level.md │ ├── you-can-validate-json-columns-at-database-level.md │ ├── you-can-validate-json-columns-at-the-database-level.md │ ├── you-can-validate-user-input-inside-middleware.md │ ├── you-can-validate-values-for-enum-database-columns-using-the-new-enum-validation-rule.md │ └── your-cli-commands-in-laravel-can-provide-auto-complete-for-the-terminal.md ├── database ├── .gitignore ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ └── 2019_08_19_000000_create_failed_jobs_table.php └── seeders │ └── DatabaseSeeder.php ├── package-lock.json ├── package.json ├── phpunit.xml ├── public ├── .htaccess ├── apple-touch-icon.png ├── css │ └── app.css ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon.ico ├── index.php ├── js │ └── app.js ├── mix-manifest.json ├── og.png ├── robots.txt └── web.config ├── resources ├── css │ └── app.css ├── js │ └── app.js ├── lang │ └── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php └── views │ ├── components │ ├── author-card.blade.php │ ├── banner.blade.php │ ├── container.blade.php │ ├── feed.blade.php │ ├── layout.blade.php │ ├── link.blade.php │ └── socials.blade.php │ ├── threads │ └── show.blade.php │ └── tips │ ├── index.blade.php │ └── show.blade.php ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── server.php ├── static └── .gitignore ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tailwind.config.js ├── tests ├── CreatesApplication.php ├── Feature │ └── ExampleTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php └── webpack.mix.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archtechx/laravel-tips/2d53681753d922d8d1a6f899f44c4ced6fb0a834/.DS_Store -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/hot 3 | /public/storage 4 | /storage/*.key 5 | /vendor 6 | .env 7 | .env.backup 8 | .phpunit.result.cache 9 | docker-compose.override.yml 10 | Homestead.json 11 | Homestead.yaml 12 | npm-debug.log 13 | yarn-error.log 14 | composer.lock 15 | -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | php: 2 | preset: laravel 3 | disabled: 4 | - no_unused_imports 5 | finder: 6 | not-name: 7 | - index.php 8 | - server.php 9 | js: 10 | finder: 11 | not-name: 12 | - webpack.mix.js 13 | css: true 14 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | convertToHtml($expression); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | id = $id; 19 | $this->name = $name; 20 | $this->username = $username; 21 | $this->profile_image_url = $profile_image_url; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /content/authors/AshAllenDesign.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: AshAllenDesign 3 | avatar: 'https://pbs.twimg.com/profile_images/1396951805775466501/FSQQmSCQ_normal.jpg' 4 | name: 'Ash Allen 🚀' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/AzizullahSamim.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: AzizullahSamim 3 | name: 'Azizullah Samim' 4 | avatar: 'https://pbs.twimg.com/profile_images/1335270749775540225/TUHwxsQ3_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/BurtDS.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: BurtDS 3 | name: 'Bert De Swaef' 4 | avatar: 'https://pbs.twimg.com/profile_images/1042044375688196097/Ktoa7v3p_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/DanSysAnalyst.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: DanSysAnalyst 3 | name: 'Dan 🇺🇦' 4 | avatar: 'https://pbs.twimg.com/profile_images/1378978815712628737/V2q0dtWi_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/DianaWebdev.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: DianaWebdev 3 | name: Di 4 | avatar: 'https://pbs.twimg.com/profile_images/1437883999955869707/9Pz4IAhZ_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/JackEllis.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: JackEllis 3 | name: 'Jack Ellis' 4 | avatar: 'https://pbs.twimg.com/profile_images/989296839194173440/ZRsVtbV5_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/JuanDMeGon.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: JuanDMeGon 3 | avatar: 'https://pbs.twimg.com/profile_images/1500323412874518537/2dwFOO6c_normal.jpg' 4 | name: 'JuanDMeGon | Online Instructor | Sr. Software Eng.' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/JustinBTechGuy.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: JustinBTechGuy 3 | name: 'Justin Byrne' 4 | avatar: 'https://pbs.twimg.com/profile_images/992054782130032640/86q1ZDeK_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/LarsKlopstra.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: LarsKlopstra 3 | name: 'Lars Klopstra ⚡' 4 | avatar: 'https://pbs.twimg.com/profile_images/1431208147193057286/dKXhDHT9_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/LiamHammett.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: LiamHammett 3 | name: 'Liam Hammett' 4 | avatar: 'https://pbs.twimg.com/profile_images/1436690674833891341/vOl5qtiA_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/LupinityLabs.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: LupinityLabs 3 | name: 'Lupinity Labs | Freelance Software Dev' 4 | avatar: 'https://pbs.twimg.com/profile_images/918075255540928514/a0jLVHar_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/MikeVILT.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: MikeVILT 3 | name: Mike 4 | avatar: 'https://pbs.twimg.com/profile_images/1488516571073024001/t4KUs74i_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/Philo01.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: Philo01 3 | name: 'Philo Hermans' 4 | avatar: 'https://pbs.twimg.com/profile_images/1448987517471035394/vEJljnOY_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/PovilasKorop.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: PovilasKorop 3 | name: 'Povilas Korop | Laravel Courses Creator & Youtuber' 4 | avatar: 'https://pbs.twimg.com/profile_images/1576085948743524352/JQ-gfbyf_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/RBilloir.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: RBilloir 3 | name: 'Romain ''Maz'' BILLOIR' 4 | avatar: 'https://pbs.twimg.com/profile_images/1154617719330922498/93xUoei7_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/Sileence.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: Sileence 3 | name: 'Duilio Palacios' 4 | avatar: 'https://pbs.twimg.com/profile_images/916349154951081984/2rJdpjIi_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/SteveTheBauman.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: SteveTheBauman 3 | name: 'Steve Bauman' 4 | avatar: 'https://pbs.twimg.com/profile_images/1447680179560751115/8Wm9RSco_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/aarondfrancis.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: aarondfrancis 3 | avatar: 'https://pbs.twimg.com/profile_images/1503487031330197518/J4i7ofgt_normal.jpg' 4 | name: 'Aaron Francis' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/abrardev99.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: abrardev99 3 | name: 'Abrar Ahmad' 4 | avatar: 'https://pbs.twimg.com/profile_images/1362979075518648325/vQ52oxSn_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/alanrezende.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: alanrezende 3 | name: 'Alan Rezende' 4 | avatar: 'https://pbs.twimg.com/profile_images/1404889748896993288/R7HpEXS9_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/alexjgarrett.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: alexjgarrett 3 | avatar: 'https://pbs.twimg.com/profile_images/1501500078816739329/xDWzyhtN_normal.jpg' 4 | name: 'Alex Garrett-Smith' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/anwar_nairi.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: anwar_nairi 3 | name: Anwar 4 | avatar: 'https://pbs.twimg.com/profile_images/1253970848907776000/-gMh35LG_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/archtechx.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: archtechx 3 | name: ARCHTECH 4 | avatar: 'https://pbs.twimg.com/profile_images/1393303364390227974/uaP8Hoq1_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/asantibanez.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: asantibanez 3 | name: 'Andrés Santibáñez' 4 | avatar: 'https://pbs.twimg.com/profile_images/1003126488957321218/d-e02mzF_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/aschmelyun.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: aschmelyun 3 | name: 'Andrew Schmelyun' 4 | avatar: 'https://pbs.twimg.com/profile_images/1079118209561841671/dI-xB5Az_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/austencam.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: austencam 3 | name: 'Austen Cameron' 4 | avatar: 'https://pbs.twimg.com/profile_images/1398382260542390279/83-mTSq1_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/avosalmon.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: avosalmon 3 | name: 'Ryuta Hamasaki' 4 | avatar: 'https://pbs.twimg.com/profile_images/1483465394862301195/41WCb6-A_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/bhaidar.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: bhaidar 3 | avatar: 'https://pbs.twimg.com/profile_images/1381347341400215552/LvVOFV9__normal.jpg' 4 | name: 'Bilal Haidar | Laravel Enthusiast' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/bobbybouwmann.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: bobbybouwmann 3 | name: 'Bobby Bouwmann' 4 | avatar: 'https://pbs.twimg.com/profile_images/1480249385288146948/Xn-QKln5_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/bradyrenting.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: bradyrenting 3 | name: 'Brady Renting' 4 | avatar: 'https://pbs.twimg.com/profile_images/1339877287676788737/Sw4qrlnF_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/brendt_gd.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: brendt_gd 3 | name: Brent 4 | avatar: 'https://pbs.twimg.com/profile_images/1425316325845504000/XEnr-h2a_normal.png' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/carre_sam.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: carre_sam 3 | name: 'Sam Carré 🤠' 4 | avatar: 'https://pbs.twimg.com/profile_images/1483207390271004678/1l9fV1y-_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/cerbero90.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: cerbero90 3 | name: 'Andrea Marco Sartori' 4 | avatar: 'https://pbs.twimg.com/profile_images/956500408377139200/QkHAZFZ9_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/cosmeescobedo.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: cosmeescobedo 3 | name: 'Cosme Escobedo' 4 | avatar: 'https://pbs.twimg.com/profile_images/1491156731203710979/T0DNLMns_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/danjharrin.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: danjharrin 3 | avatar: 'https://pbs.twimg.com/profile_images/1516140349890170883/Y275v9JG_normal.jpg' 4 | name: 'Dan Harrin 🦒' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/djgeisi.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: djgeisi 3 | name: 'Tim Geisendoerfer' 4 | avatar: 'https://pbs.twimg.com/profile_images/1417203113551925251/YtYwDdMt_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/doekenorg.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: doekenorg 3 | name: 'Doeke Norg' 4 | avatar: 'https://pbs.twimg.com/profile_images/641960403287834624/OLaPNjGt_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/ecrmnn.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: ecrmnn 3 | avatar: 'https://pbs.twimg.com/profile_images/1524726574095998976/eIfzkehc_normal.jpg' 4 | name: 'Daniel Eckermann' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/enunomaduro.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: enunomaduro 3 | avatar: 'https://pbs.twimg.com/profile_images/1573244584943042560/9Mq8p_QH_normal.jpg' 4 | name: 'nuno maduro 🤌🏻' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/fideloper.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: fideloper 3 | name: 'Chris Fidao' 4 | avatar: 'https://pbs.twimg.com/profile_images/2256212126/fideloper_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/frankdejonge.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: frankdejonge 3 | name: 'Frank de Jonge' 4 | avatar: 'https://pbs.twimg.com/profile_images/1458371876426821636/MFOPqVaX_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/freekmurze.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: freekmurze 3 | avatar: 'https://pbs.twimg.com/profile_images/1578325143356678146/sf9MoAbW_normal.jpg' 4 | name: 'Freek Van der Herten 🔭' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/iamharis010.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: iamharis010 3 | name: 'Mohammad Haris ⚡' 4 | avatar: 'https://pbs.twimg.com/profile_images/1491541849198133248/WLgcha1__normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/itsmarkmead.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: itsmarkmead 3 | name: 'Mark Mead' 4 | avatar: 'https://pbs.twimg.com/profile_images/1425351075054379010/qypNHjGY_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/jasonlbeggs.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: jasonlbeggs 3 | name: 'Jason Beggs' 4 | avatar: 'https://pbs.twimg.com/profile_images/1391946980960743425/xi3nDA3k_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/jbrooksuk.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: jbrooksuk 3 | avatar: 'https://pbs.twimg.com/profile_images/1537504111939268609/z5JpARYC_normal.jpg' 4 | name: 'James Brooks 🥭' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/jessarchercodes.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: jessarchercodes 3 | name: 'Jess Archer' 4 | avatar: 'https://pbs.twimg.com/profile_images/1149493363470585858/2aa3eHfK_normal.png' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/joemasilotti.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: joemasilotti 3 | name: 'Joe Masilotti 📗' 4 | avatar: 'https://pbs.twimg.com/profile_images/1469703667791982596/5-0pGyNV_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/jordankdalton.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: jordankdalton 3 | name: 'Jordan Dalton' 4 | avatar: 'https://pbs.twimg.com/profile_images/1408944806517161986/KtHWdoeI_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/justsanjit.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: justsanjit 3 | name: 'Sanjit Singh' 4 | avatar: 'https://pbs.twimg.com/profile_images/1478587890078683142/sefIvjbF_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/laracasts.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: laracasts 3 | name: Laracasts 4 | avatar: 'https://pbs.twimg.com/profile_images/1445387653763977228/ZY_bh6BZ_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/laravelnews.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: laravelnews 3 | name: 'Laravel News' 4 | avatar: 'https://pbs.twimg.com/profile_images/1359866716222861317/coQ-RmRS_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/marcelpociot.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: marcelpociot 3 | name: 'Marcel Pociot 🧪' 4 | avatar: 'https://pbs.twimg.com/profile_images/1467572011392245769/VDwu7_7w_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/mattkingshott.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: mattkingshott 3 | name: 'Matt Kingshott 🏝' 4 | avatar: 'https://pbs.twimg.com/profile_images/1444979706571415564/toC9_E-T_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/mmartin_joo.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: mmartin_joo 3 | name: 'Martin Joo' 4 | avatar: 'https://pbs.twimg.com/profile_images/1483820583703953408/xRSnZ96H_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/morrislaptop.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: morrislaptop 3 | name: 'Craig Morris' 4 | avatar: 'https://pbs.twimg.com/profile_images/1392560435942019072/24MDzj0X_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/mvpopuk.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: mvpopuk 3 | name: 'Marian Pop 🐘' 4 | avatar: 'https://pbs.twimg.com/profile_images/1470871614594113537/C3AsiJLb_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/nuernberger_me.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: nuernberger_me 3 | name: 'Adrian Nürnberger 🐙' 4 | avatar: 'https://pbs.twimg.com/profile_images/723494877489717248/TMw1-Osd_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/pascalbaljet.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: pascalbaljet 3 | name: 'Pascal Baljet 🚀' 4 | avatar: 'https://pbs.twimg.com/profile_images/1166590157925076993/aNpvJqRy_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/realstevebauman.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: realstevebauman 3 | name: 'Steve Bauman' 4 | avatar: 'https://pbs.twimg.com/profile_images/1447680179560751115/8Wm9RSco_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/reinink.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: reinink 3 | name: 'Jonathan Reinink' 4 | avatar: 'https://pbs.twimg.com/profile_images/885868801232961537/b1F6H4KC_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/ryangjchandler.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: ryangjchandler 3 | avatar: 'https://pbs.twimg.com/profile_images/1546042999183917058/i2AEMBGr_normal.png' 4 | name: 'Ryan Chandler' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/samuelstancl.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: samuelstancl 3 | name: 'Samuel Štancl' 4 | avatar: 'https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/sebdedeyne.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: sebdedeyne 3 | name: 'Sebastian De Deyne' 4 | avatar: 'https://pbs.twimg.com/profile_images/598011661178408960/C4xJt3aO_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/sharik_709.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: sharik_709 3 | name: 'Sharik Shaikh' 4 | avatar: 'https://pbs.twimg.com/profile_images/1449051129845714947/XFQAdiQK_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/sky_0xs.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: sky_0xs 3 | name: 'Oussama Sid' 4 | avatar: 'https://pbs.twimg.com/profile_images/1405143897177694210/C-7sXUQ__normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/taylorotwell.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: taylorotwell 3 | name: 'Taylor Otwell 🪐' 4 | avatar: 'https://pbs.twimg.com/profile_images/1439602105107443714/Vpb3Ra1K_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/timacdonald87.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: timacdonald87 3 | avatar: 'https://pbs.twimg.com/profile_images/1495883253445959681/xLo3tosq_normal.jpg' 4 | name: 'Tim MacDonald' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/tobias_petry.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: tobias_petry 3 | avatar: 'https://pbs.twimg.com/profile_images/1449987893980766209/iPIfnmTE_normal.jpg' 4 | name: Tobias_Petry.sql 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/victoryoalli.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: victoryoalli 3 | name: '🧔🏻Victor Yoalli' 4 | avatar: 'https://pbs.twimg.com/profile_images/1511729912297627657/LmidlmsF_normal.png' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/warsh33p.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: warsh33p 3 | name: 'Kai Sassnowski 🥔' 4 | avatar: 'https://pbs.twimg.com/profile_images/1471470755355443210/pCy5acDI_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/xiCO2k.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: xiCO2k 3 | name: 'Francisco Madeira' 4 | avatar: 'https://pbs.twimg.com/profile_images/1238877427306242055/aspixMYU_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/authors/zepfietje.md: -------------------------------------------------------------------------------- 1 | --- 2 | username: zepfietje 3 | name: 'Zep Fietje' 4 | avatar: 'https://pbs.twimg.com/profile_images/1486773319189815314/VstRGufn_normal.jpg' 5 | --- 6 | -------------------------------------------------------------------------------- /content/threads/1-rt-1-tip.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: 1-rt-1-tip 3 | title: '1 RT = 1 tip' 4 | tweet_id: 1308082888324374528 5 | author_username: samuelstancl 6 | created_at: 2021-04-07T18:16:23+00:00 7 | links: {} 8 | --- 9 | A thread of misc tips, originally one tip per one retweet. 10 | -------------------------------------------------------------------------------- /content/threads/laravel-clean-code-tactics.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: laravel-clean-code-tactics 3 | title: 'Laravel Clean Code Tactics' 4 | tweet_id: 1272822437181378561 5 | author_username: samuelstancl 6 | created_at: 2021-04-07T18:16:07+00:00 7 | links: 8 | download: 9 | name: Printable versions 10 | url: https://gum.co/laravel-clean-code 11 | --- 12 | The OG thread. Get printable PDF versions [here](https://gum.co/laravel-clean-code). 13 | -------------------------------------------------------------------------------- /content/threads/obscure-livewire-tips.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: obscure-livewire-tips 3 | title: 'Obscure Livewire Tips' 4 | tweet_id: 1380538340982788096 5 | author_username: samuelstancl 6 | created_at: 2021-04-09T15:19:23+02:00 7 | links: 8 | download: 9 | name: Download code 10 | url: https://gum.co/livewire-tips 11 | --- 12 | 13 | Little-known Livewire tips. 14 | 15 | Get the supporting resources, code examples, and Blade directives [here](https://gum.co/livewire-tips). 16 | -------------------------------------------------------------------------------- /content/threads/pest-tips.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: pest-tips 3 | title: 'Pest Tips' 4 | tweet_id: 1427310302656438274 5 | author_username: archtechx 6 | created_at: 2021-08-16T19:09:23+02:00 7 | links: {} 8 | --- 9 | -------------------------------------------------------------------------------- /content/threads/weekly-thread-2021-42.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2021-42 3 | title: 'Weekly thread #42 of 2021' 4 | tweet_id: '1451526348132978689' 5 | author_username: archtechx 6 | created_at: 2021-10-24T11:19:00+00:00 7 | links: { } 8 | --- 9 | 🔥 This week’s code tips for Laravel developers 10 | -------------------------------------------------------------------------------- /content/threads/weekly-thread-2021-43.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2021-43 3 | title: 'Weekly thread #43 of 2021' 4 | tweet_id: '1454133799164522500' 5 | author_username: archtechx 6 | created_at: 2021-10-29T19:11:30+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | Lots of cool stuff from @enunomaduro and two competing JSON tips 💪 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2021-44.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2021-44 3 | title: 'Weekly thread #44 of 2021' 4 | tweet_id: '1456649610621902860' 5 | author_username: archtechx 6 | created_at: 2021-11-05T16:04:14+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's tips for Laravel developers 10 | 11 | Lots of great tweets this week, thanks to everyone for posting them! They're helpful to everyone in the community ❤️ -------------------------------------------------------------------------------- /content/threads/weekly-thread-2021-45.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2021-45 3 | title: 'Weekly thread #45 of 2021' 4 | tweet_id: '1459206732329086981' 5 | author_username: archtechx 6 | created_at: 2021-11-12T17:39:54+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's tips for Laravel developers 10 | 11 | As always, huge thanks to everyone making these tweets ❤️ -------------------------------------------------------------------------------- /content/threads/weekly-thread-2021-46.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2021-46 3 | title: 'Weekly thread #46 of 2021' 4 | tweet_id: '1461703825039892486' 5 | author_username: archtechx 6 | created_at: 2021-11-19T15:07:06+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2021-47.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2021-47 3 | title: 'Weekly thread #47 of 2021' 4 | tweet_id: '1464247621518651392' 5 | author_username: archtechx 6 | created_at: 2021-11-26T15:16:37+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2021-48.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2021-48 3 | title: 'Weekly thread #48 of 2021' 4 | tweet_id: '1466810181308715009' 5 | author_username: archtechx 6 | created_at: 2021-12-03T17:27:54+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | 🧵 A weekly thread -------------------------------------------------------------------------------- /content/threads/weekly-thread-2021-49.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2021-49 3 | title: 'Weekly thread #49 of 2021' 4 | tweet_id: '1469321059585331201' 5 | author_username: archtechx 6 | created_at: 2021-12-10T15:22:03+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | 🧵 A weekly thread -------------------------------------------------------------------------------- /content/threads/weekly-thread-2021-50.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2021-50 3 | title: 'Weekly thread #50 of 2021' 4 | tweet_id: '1471864631312404492' 5 | author_username: archtechx 6 | created_at: 2022-01-07T12:56:47+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 12 | -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-01.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-01 3 | title: 'Weekly thread #01 of 2022' 4 | tweet_id: '1479467928818892800' 5 | author_username: archtechx 6 | created_at: 2022-01-09T18:27:35+00:00 7 | links: { } 8 | --- 9 | 🔥 Latest code tips for Laravel developers 10 | 11 | First week's special: news from the past 3 weeks 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-02.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-02 3 | title: 'Weekly thread #02 of 2022' 4 | tweet_id: '1482036548921016321' 5 | author_username: archtechx 6 | created_at: 2022-01-14T18:06:24+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | 🧵 A weekly thread -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-03.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-03 3 | title: 'Weekly thread #03 of 2022' 4 | tweet_id: '1484566695356211201' 5 | author_username: archtechx 6 | created_at: 2022-01-21T17:08:37+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-04.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-04 3 | title: 'Weekly thread #04 of 2022' 4 | tweet_id: '1487081923289640961' 5 | author_username: archtechx 6 | created_at: 2022-01-28T16:33:49+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-05.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-05 3 | title: 'Weekly thread #05 of 2022' 4 | tweet_id: '1489620159585153026' 5 | author_username: archtechx 6 | created_at: 2022-02-04T21:42:06+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 12 | -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-06.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-06 3 | title: 'Weekly thread #06 of 2022' 4 | tweet_id: '1494019542648901632' 5 | author_username: archtechx 6 | created_at: 2022-02-16T18:44:38+00:00 7 | links: { } 8 | --- 9 | 🔥 Last week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 12 | 13 | https://twitter.com/archtechx/status/1493663801715081221 14 | -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-07.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-07 3 | title: 'Weekly thread #07 of 2022' 4 | tweet_id: '1495414929053995012' 5 | author_username: archtechx 6 | created_at: 2022-02-20T15:07:57+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-08.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-08 3 | title: 'Weekly thread #08 of 2022' 4 | tweet_id: '1498010788463710209' 5 | author_username: archtechx 6 | created_at: 2022-02-27T19:02:58+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-09.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-09 3 | title: 'Weekly thread #09 of 2022' 4 | tweet_id: '1499806895242039297' 5 | author_username: archtechx 6 | created_at: 2022-03-04T18:00:03+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-10.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-10 3 | title: 'Weekly thread #10 of 2022' 4 | tweet_id: '1502367760927625219' 5 | author_username: archtechx 6 | created_at: 2022-03-11T19:36:01+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-11.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-11 3 | title: 'Weekly thread #11 of 2022' 4 | tweet_id: '1505269883038158848' 5 | author_username: archtechx 6 | created_at: 2022-03-19T19:48:01+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-12.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-12 3 | title: 'Weekly thread #12 of 2022' 4 | tweet_id: '1507455535322308610' 5 | author_username: archtechx 6 | created_at: 2022-03-25T20:33:01+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-13.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-13 3 | title: 'Weekly thread #13 of 2022' 4 | tweet_id: '1509994014090711041' 5 | author_username: archtechx 6 | created_at: 2022-04-01T20:40:01+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-14.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-14 3 | title: 'Weekly thread #14 of 2022' 4 | tweet_id: '1512463786405294081' 5 | author_username: archtechx 6 | created_at: 2022-04-08T16:14:01+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-15.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-15 3 | title: 'Weekly thread #15 of 2022' 4 | tweet_id: '1515057381511610368' 5 | author_username: archtechx 6 | created_at: 2022-04-15T20:00:02+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-16.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-16 3 | title: 'Weekly thread #16 of 2022' 4 | tweet_id: '1517561123582619648' 5 | author_username: archtechx 6 | created_at: 2022-04-22T17:49:01+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-17.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-17 3 | title: 'Weekly thread #17 of 2022' 4 | tweet_id: '1520040279092326405' 5 | author_username: archtechx 6 | created_at: 2022-04-29T14:00:18+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-20.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-20 3 | title: 'Weekly thread #20 of 2022' 4 | tweet_id: '1527688608286535680' 5 | author_username: archtechx 6 | created_at: 2022-05-20T16:32:01+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-21.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-21 3 | title: 'Weekly thread #21 of 2022' 4 | tweet_id: '1530215255732649985' 5 | author_username: archtechx 6 | created_at: 2022-05-27T15:52:01+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-22.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-22 3 | title: 'Weekly thread #22 of 2022' 4 | tweet_id: '1532800036882374657' 5 | author_username: archtechx 6 | created_at: 2022-06-03T19:03:01+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-24.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-24 3 | title: 'Weekly thread #24 of 2022' 4 | tweet_id: '1538579116080762880' 5 | author_username: archtechx 6 | created_at: 2022-06-19T17:47:01+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-25.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-25 3 | title: 'Weekly thread #25 of 2022' 4 | tweet_id: '1540401124192112640' 5 | author_username: archtechx 6 | created_at: 2022-06-24T18:27:01+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-26.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-26 3 | title: 'Weekly thread #26 of 2022' 4 | tweet_id: '1542863724968480769' 5 | author_username: archtechx 6 | created_at: 2022-07-01T13:32:31+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips for Laravel developers 10 | 11 | A weekly thread 🧵 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-27.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-27 3 | title: 'Weekly thread #27 of 2022' 4 | tweet_id: '1545465995606650880' 5 | author_username: archtechx 6 | created_at: 2022-07-08T17:53:01+00:00 7 | links: { } 8 | --- 9 | This week's news and code tips for Laravel developers include: 10 | 11 | ⚡ Fast ⚡️ Paginate 12 | ☀️ Laracon Summer 2022 13 | 🆕 Laracasts CreatorSeries 14 | ✅ The State of Laravel Survey 15 | 🌟 Laravel SingleStoreDB driver v1 16 | 17 | and more... 18 | 19 | Thread #128 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-28.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-28 3 | title: 'Weekly thread #28 of 2022' 4 | tweet_id: '1547939795942248451' 5 | author_username: archtechx 6 | created_at: 2022-07-15T13:43:01+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's code tips and updates for Laravel developers include: 10 | 11 | ✨ Laravel Nova v4.12 12 | 🔥 Blade hot refreshing 13 | 👨🏻‍🏫 Learn with Christoph Rumpel 14 | 3️⃣ Three rules for creating database indices 15 | 🆓 Request Data Access task in Shift Workbench 16 | 17 | and more... 18 | 19 | Thread #129 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-29.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-29 3 | title: 'Weekly thread #29 of 2022' 4 | tweet_id: '1550466495032897544' 5 | author_username: archtechx 6 | created_at: 2022-07-22T13:03:13+00:00 7 | links: { } 8 | --- 9 | 🔥 This week's updates and code tips for Laravel developers include: 10 | 11 | 🚀 Laravel 9.21 released 12 | 🌟 New updates in Vapor 13 | 🍺 Pint included by default 14 | ✨ Vite 3 support across the ecosystem 15 | 📘 Laravel Model Pruning on Codecourse 16 | 17 | and more... 18 | 19 | Thread #130 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-30.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-30 3 | title: 'Weekly thread #30 of 2022' 4 | tweet_id: '1553002656955830272' 5 | author_username: archtechx 6 | created_at: 2022-07-29T13:01:01+00:00 7 | links: { } 8 | --- 9 | This week's news and tips for Laravel developers include: 10 | 11 | 🍺 Laravel Pint v1.1 12 | 🚀 Deployer v7 is out 13 | 🆕 Laravel 9.22 released 14 | 💫 New updates in Spark Stripe 15 | 📘 Codecourse and Laracast series 16 | 17 | and more... 18 | 19 | Thread #131 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-31.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-31 3 | title: 'Weekly thread #31 of 2022' 4 | tweet_id: '1555543649751932928' 5 | author_username: archtechx 6 | created_at: 2022-08-05T13:18:01+00:00 7 | links: { } 8 | --- 9 | This week's news and code tips for Laravel developers include: 10 | 11 | 🆕 Laravel 9.23 12 | 📦 Haystack package 13 | ✨ Octane v1.3 released 14 | 🏢 Tailwind CSS job board 15 | 🍃 Termwind v1.14 released 16 | 17 | and more... 18 | 19 | Thread #132 -------------------------------------------------------------------------------- /content/threads/weekly-thread-2022-35.md: -------------------------------------------------------------------------------- 1 | --- 2 | slug: weekly-thread-2022-35 3 | title: 'Weekly thread #35 of 2022' 4 | tweet_id: '1596508349322866688' 5 | author_username: archtechx 6 | created_at: 2022-11-26T14:17:06+00:00 7 | links: { } 8 | --- 9 | 🔥 We're back to posting our threads! 10 | 11 | In our news thread (will be posted shortly after this one), I'll share some updates about Tenancy v4 and our content schedule 12 | 13 | In the meantime: Best Laravel tips from the past few months 👇 -------------------------------------------------------------------------------- /content/tips/add-a-recursive-macro-to-convert-an-array-including-its-children-to-collections.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Add a recursive() macro to convert an array including its children to Collections' 3 | tweet_id: '1459206744467410946' 4 | thread_slug: weekly-thread-2021-45 5 | author_username: alexjgarrett 6 | images: 7 | - 'https://pbs.twimg.com/media/FD8ObI6XsAQMldB.jpg' 8 | created_at: 2021-11-12T17:09:33+00:00 9 | slug: add-a-recursive-macro-to-convert-an-array-including-its-children-to-collections 10 | --- 11 | A handy @laravelphp Collection macro to convert an array and its children to Collections, using recursion. -------------------------------------------------------------------------------- /content/tips/advanced-notifications.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Advanced notifications' 3 | tweet_id: '' 4 | thread_slug: obscure-livewire-tips 5 | author_username: samuelstancl 6 | images: 7 | - 'https://cln.sh/AAMo0d/download' 8 | created_at: 2021-04-09T17:24:56+02:00 9 | slug: advanced-notifications 10 | --- 11 | 12 | This trait allows dispatching notifications: 13 | - on the current page 14 | - on the next page (after redirect) 15 | - from any part of your code: you can run Lean::notify() in an action class, a model method, or anywhere else — and it will be sent to the browser 16 | -------------------------------------------------------------------------------- /content/tips/advanced-trait-design.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Advanced trait design' 3 | tweet_id: '' 4 | thread_slug: obscure-livewire-tips 5 | author_username: samuelstancl 6 | images: 7 | - 'https://cln.sh/YjzF2w/download' 8 | created_at: 2021-04-09T17:23:56+02:00 9 | slug: advanced-trait-design 10 | --- 11 | 12 | Let's look at the same trait again. It does two interesting things. 13 | 14 | 1. Livewire::listen() is superior to hydrate* and dehydrate* when you need access to specific parts of the lifecycle 15 | 16 | 2. The `instanceof self` check scopes the listener to the component 17 | -------------------------------------------------------------------------------- /content/tips/array-destructuring-in-php-is-very-powerful-yet-still-underutilized.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Array destructuring in PHP is very powerful, yet still underutilized' 3 | tweet_id: '1484566707133825024' 4 | thread_slug: weekly-thread-2022-03 5 | author_username: aschmelyun 6 | images: 7 | - 'https://pbs.twimg.com/media/FJg9H52X0AYdyL3.jpg' 8 | created_at: 2022-01-21T16:40:59+00:00 9 | slug: array-destructuring-in-php-is-very-powerful-yet-still-underutilized 10 | --- 11 | Array destructuring is probably one of my favorite things in modern PHP and I don't think I use it enough -------------------------------------------------------------------------------- /content/tips/avoid-helper-classes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Avoid helper *classes*' 3 | tweet_id: '1272822458563821568' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean2CnyWoAEZ3Ef.jpg' 8 | created_at: 2020-06-16T09:24:56+00:00 9 | slug: avoid-helper-classes 10 | --- 11 | 12 | Sometimes people put helpers into a class. 13 | 14 | Beware, it can get messy. This is a class with only static methods used as helper functions. It's usually better to put these methods into classes with related logic or just keep them as global functions. -------------------------------------------------------------------------------- /content/tips/avoid-queries-in-blade-when-possible.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Avoid queries in Blade when possible' 3 | tweet_id: '1272826450559803392' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean7jvPWkAAp2_6.jpg' 8 | created_at: 2020-06-16T09:40:48+00:00 9 | slug: avoid-queries-in-blade-when-possible 10 | --- 11 | 12 | Sometimes you may want to execute DB queries in blade. There are some ok use cases for this, such as in layout files. 13 | 14 | But if it's a view returned by a controller, pass the data in the view data instead. -------------------------------------------------------------------------------- /content/tips/be-careful-about-setting-timezones-with-carbon.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Be careful about setting timezones with Carbon' 3 | tweet_id: '1499806898136117248' 4 | thread_slug: weekly-thread-2022-09 5 | author_username: freekmurze 6 | images: 7 | - 'https://pbs.twimg.com/media/FMwTTWZXsAUfgHT.jpg' 8 | created_at: 2022-03-04T18:00:04+00:00 9 | slug: be-careful-about-setting-timezones-with-carbon 10 | --- 11 | ❗️⏰ When working with Carbon/timezones, you should be aware that setting the timezone during construction is not the same as altering the timezone later. 👍 -------------------------------------------------------------------------------- /content/tips/be-careful-if-youre-not-scoping-your-route-model-bindings.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Be careful if you''re not scoping your route model bindings ' 3 | tweet_id: '1547939806788734976' 4 | thread_slug: weekly-thread-2022-28 5 | author_username: realstevebauman 6 | images: 7 | - 'https://pbs.twimg.com/media/FXoucXVUEAINVm5.jpg' 8 | created_at: 2022-07-15T13:43:03+00:00 9 | slug: be-careful-if-youre-not-scoping-your-route-model-bindings 10 | --- 11 | 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! -------------------------------------------------------------------------------- /content/tips/be-friends-with-your-ide.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Be friends with your IDE' 3 | tweet_id: '1272826441424613378' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean6t2ZXgAEiJMa.jpg' 8 | created_at: 2020-06-16T09:40:46+00:00 9 | slug: be-friends-with-your-ide 10 | --- 11 | 12 | Install extensions, write annotations, use typehints. Your IDE will help you with getting your code working correctly, which lets you spend more energy on writing code that's also readable. -------------------------------------------------------------------------------- /content/tips/blades-at-class-directive-can-significantly-clean-up-your-templates.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Blade''s @class directive can significantly clean up your templates' 3 | tweet_id: '1532800041957568512' 4 | thread_slug: weekly-thread-2022-22 5 | author_username: xiCO2k 6 | images: 7 | - 'https://pbs.twimg.com/media/FUB1KVpWIAs25_Y.jpg' 8 | created_at: 2022-06-03T19:03:02+00:00 9 | slug: blades-at-class-directive-can-significantly-clean-up-your-templates 10 | --- 11 | ✅ The Laravel Blade Class Directive is really awesome, so much cleaner! 🧹🧹 -------------------------------------------------------------------------------- /content/tips/call-methods-from-javascript.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Call methods from JavaScript' 3 | tweet_id: '1380545900020436996' 4 | thread_slug: obscure-livewire-tips 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EyivLICXIAEX-40.jpg' 8 | created_at: 2021-04-09T17:11:56+02:00 9 | slug: call-methods-from-javascript 10 | --- 11 | 12 | Livewire's properties are extremely powerful, which often makes us forget that we can also call methods from the frontend. 13 | 14 | Livewire gives you a full component API. Use it! 15 | -------------------------------------------------------------------------------- /content/tips/class-constructor-property-promotion-pairs-extremely-well-with-dtos.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Class 🔥 Constructor property promotion pairs extremely well with DTOs' 3 | tweet_id: '1532800044725723136' 4 | thread_slug: weekly-thread-2022-22 5 | author_username: archtechx 6 | images: 7 | - 'https://pbs.twimg.com/media/FUKzQY_UcAIOA3t.jpg' 8 | created_at: 2022-06-03T19:03:03+00:00 9 | slug: class-constructor-property-promotion-pairs-extremely-well-with-dtos 10 | --- 11 | 🔥 PHP 8 has made DTOs *much* easier with constructor property promotion -------------------------------------------------------------------------------- /content/tips/class-you-can-use-the-at-env-blade-directive-to-render-stuff-only-in-a-given-environment.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Class 🔥 You can use the @env Blade directive to render stuff only in a given environment' 3 | tweet_id: '1532800047418462208' 4 | thread_slug: weekly-thread-2022-22 5 | author_username: freekmurze 6 | images: 7 | - 'https://pbs.twimg.com/media/FT1tH1sWQAAaEwH.jpg' 8 | created_at: 2022-06-03T19:03:04+00:00 9 | slug: class-you-can-use-the-at-env-blade-directive-to-render-stuff-only-in-a-given-environment 10 | --- 11 | 🔥 Did you know that Laravel has a handy Blade directive to only render stuff in a given environment? -------------------------------------------------------------------------------- /content/tips/closure-validation-rules-are-theyre-often-better-than-creating-a-class-just-for-a-single-use.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Closure validation rules are 🔥. They''re often better than creating a class just for a single use' 3 | tweet_id: '1308085658095886336' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidAtSYXgAc-6tH.png' 8 | created_at: 2020-09-21T16:48:18+00:00 9 | slug: closure-validation-rules-are-theyre-often-better-than-creating-a-class-just-for-a-single-use 10 | --- 11 | 12 | Create a class if it's used on multiple places or way too complex. -------------------------------------------------------------------------------- /content/tips/compare-models-using-is-instead-of-directly-comparing-attributes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Compare models using is() instead of directly comparing attributes' 3 | tweet_id: '1479467936700010504' 4 | thread_slug: weekly-thread-2022-01 5 | author_username: archtechx 6 | images: 7 | - 'https://pbs.twimg.com/media/FHJNmt3VEAIYtCy.jpg' 8 | created_at: 2022-01-07T15:00:17+00:00 9 | slug: compare-models-using-is-instead-of-directly-comparing-attributes 10 | --- 11 | 🔥 Tip: Compare models using ->is() instead of doing direct attribute value comparisons 12 | 13 | This is a simpler version of the tip below https://twitter.com/archtechx/status/1465334771349811219 14 | -------------------------------------------------------------------------------- /content/tips/comparing-changes-on-saving-using.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Comparing changes on ''saving'' using:' 3 | tweet_id: '1308113281018728450' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidZs1IWAAUgH0m.png' 8 | created_at: 2020-09-21T18:38:04+00:00 9 | slug: comparing-changes-on-saving-using 10 | --- 11 | 12 | $model->getOriginal() 13 | 14 | in Eloquent event listeners can be very useful. 15 | 16 | One such use case is checking whether an order is locked. If it is, the only write action we permit is unlocking it. Only then can changes be made. -------------------------------------------------------------------------------- /content/tips/compose-components-using-traits.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Compose components using traits' 3 | tweet_id: '' 4 | thread_slug: obscure-livewire-tips 5 | author_username: samuelstancl 6 | images: 7 | - 'https://cln.sh/j3Jtnw/download' 8 | created_at: 2021-04-09T17:12:56+02:00 9 | slug: compose-components-using-traits 10 | --- 11 | 12 | Traits are a powerful way to reuse functionality between Livewire components. 13 | 14 | They're generally better than component nesting, since that comes with more complexity and worse performance. 15 | 16 | Next up: Advanced trait examples 17 | -------------------------------------------------------------------------------- /content/tips/consider-creating-helpers-for-model-factories.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Consider creating helpers for model factories' 3 | tweet_id: '1527688619753779200' 4 | thread_slug: weekly-thread-2022-20 5 | author_username: archtechx 6 | images: 7 | - 'https://pbs.twimg.com/media/FTL7hJEVIAAkVsa.jpg' 8 | created_at: 2022-05-20T16:32:04+00:00 9 | slug: consider-creating-helpers-for-model-factories 10 | --- 11 | If your app has only a few models, consider creating helper functions for model factories 12 | 13 | Helpers have perfect IDE support and can make your tests a lot cleaner 14 | 15 | Pairs especially well with @pestphp 💅 -------------------------------------------------------------------------------- /content/tips/consider-single-action-controllers.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Consider single-action controllers' 3 | tweet_id: '1272826438891298816' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean6Sn9XkAA-WKS.png' 8 | created_at: 2020-06-16T09:40:45+00:00 9 | slug: consider-single-action-controllers 10 | --- 11 | 12 | If you have a complex route action, consider moving it to a separate controller. 13 | 14 | For OrderController::create, you'd create CreateOrderController. 15 | 16 | Another solution is to move that logic to an action class — do what works best in your case. -------------------------------------------------------------------------------- /content/tips/consider-using-form-requests.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Consider using form requests' 3 | tweet_id: '1272822452201144321' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean0kWgXgAAcOXm.jpg' 8 | created_at: 2020-06-16T09:24:55+00:00 9 | slug: consider-using-form-requests 10 | --- 11 | 12 | They're a great place to hide complex validation logic. 13 | 14 | But beware of exactly that — hiding things. When your validation logic is simple, there's nothing wrong with doing it in the controller. Moving it to a form request makes it less explicit -------------------------------------------------------------------------------- /content/tips/consider-using-helpers-instead-of-facades-they-can-clean-things-up.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Consider using helpers instead of facades. They can clean things up' 3 | tweet_id: '1272826446717870081' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean7QGBXYAEt_l2.jpg' 8 | created_at: 2020-06-16T09:40:47+00:00 9 | slug: consider-using-helpers-instead-of-facades-they-can-clean-things-up 10 | --- 11 | 12 | This is largely a matter of personal preference, but calling a global function instead of having to import a class and statically call a method feels nicer to me. 13 | 14 | Bonus points for session('key') syntax. -------------------------------------------------------------------------------- /content/tips/consider-using-mb-functions-when-working-with-localized-strings.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Consider using mb_* functions when working with localized strings' 3 | tweet_id: '1464247627696918528' 4 | thread_slug: weekly-thread-2021-47 5 | author_username: jbrooksuk 6 | images: 7 | - 'https://pbs.twimg.com/media/FEzpA84X0AALH07.jpg' 8 | created_at: 2021-11-26T15:00:13+00:00 9 | slug: consider-using-mb-functions-when-working-with-localized-strings 10 | --- 11 | Not sure on the difference between "strtoupper" and "mb_strtoupper"? #PHP -------------------------------------------------------------------------------- /content/tips/context-matters.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Context matters' 3 | tweet_id: '1272826465378357251' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean8vC0WAAEomIq.jpg' 8 | created_at: 2020-06-16T09:40:51+00:00 9 | slug: context-matters 10 | --- 11 | 12 | Above I said that moving business logic to action/service classes is good. But context matters 13 | 14 | Here's code design advice from a popular "Laravel best practices" repo. There's absolutely no reason to put a 3-line check into a class. That's just overengineered -------------------------------------------------------------------------------- /content/tips/controllers-can-be-used-as-route-groups.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Controllers can be used as route groups' 3 | tweet_id: '1517561126334001153' 4 | thread_slug: weekly-thread-2022-16 5 | author_username: justsanjit 6 | images: 7 | - 'https://pbs.twimg.com/media/FQYpHmkWYAQXE0J.jpg' 8 | created_at: 2022-04-22T17:49:02+00:00 9 | slug: controllers-can-be-used-as-route-groups 10 | --- 11 | #Laravel Tip ⚡ Instead of using the controller in each route, consider using a route controller group. -------------------------------------------------------------------------------- /content/tips/convert-email-addresses-to-full-names-with-the-help-of-strheadline.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Convert email addresses to full names with the help of Str::headline()' 3 | tweet_id: '1487081950900736012' 4 | thread_slug: weekly-thread-2022-04 5 | author_username: SteveTheBauman 6 | images: 7 | - 'https://pbs.twimg.com/media/FKDXqE8XoAU5xO8.jpg' 8 | created_at: 2022-01-28T15:15:40+00:00 9 | slug: convert-email-addresses-to-full-names-with-the-help-of-strheadline 10 | --- 11 | Ran into a great use-case for Str::headline() -- Generating displayable usernames from email addresses 👌 -------------------------------------------------------------------------------- /content/tips/create-a-using-helper-in-pest.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Another pest tip: Create a using() helper to get perfect IDE support on $this calls inside your tests' 3 | tweet_id: '1426219050250772482' 4 | thread_slug: 'Pest Tips' 5 | author_username: archtechx 6 | images: 7 | - 'https://pbs.twimg.com/media/E8ryqTuWEAQT-1H.jpg' 8 | created_at: 2021-08-16T19:07:26+02:00 9 | slug: create-a-using-helper-in-pest 10 | --- 11 | 12 | Out of the box, @pestphp has amazing IDE support for the expect()->toBe() syntax, but sometimes you need to use $this — usually for things like HTTP calls. 13 | -------------------------------------------------------------------------------- /content/tips/create-action-classes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create action classes' 3 | tweet_id: '1272822450137546753' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean0gvIWsAAIfxK.jpg' 8 | created_at: 2020-06-16T09:24:54+00:00 9 | slug: create-action-classes 10 | --- 11 | 12 | Let's expand on the previous example. Sometimes, creating a class for a single action can clean things up. 13 | 14 | Models should encapsulate the business logic related to them, but they shouldn't be too big. -------------------------------------------------------------------------------- /content/tips/create-an-attempt-helper-for-calls-that-can-silently-fail.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create an attempt() helper for calls that can silently fail' 3 | tweet_id: '1464247622558896129' 4 | thread_slug: weekly-thread-2021-47 5 | author_username: mattkingshott 6 | images: 7 | - 'https://pbs.twimg.com/media/FE9oLAyX0AAhIM8.jpg' 8 | created_at: 2021-11-26T15:00:12+00:00 9 | slug: create-an-attempt-helper-for-calls-that-can-silently-fail 10 | --- 11 | 💡#Laravel Tip: Here's a useful little helper for when you need to run some code, but don't really need to handle any exceptions it might generate. -------------------------------------------------------------------------------- /content/tips/create-custom-blade-directives-for-business-logic.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create custom Blade directives for business logic' 3 | tweet_id: '1272826448810737670' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean7bYSXkAIwDIR.png' 8 | created_at: 2020-06-16T09:40:48+00:00 9 | slug: create-custom-blade-directives-for-business-logic 10 | --- 11 | 12 | You can make your Blade templates more expressive by creating custom directives. For example, rather than checking if the user has the admin role, you could use @admin. -------------------------------------------------------------------------------- /content/tips/create-fluent-objects.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create fluent objects' 3 | tweet_id: '1272822468219109377' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean3zqXWAAASnOP.png' 8 | created_at: 2020-06-16T09:24:58+00:00 9 | slug: create-fluent-objects 10 | --- 11 | 12 | You can also create objects with fluent APIs. Gradually add data by with separate calls, and only require the absolute minimum in the constructor. 13 | 14 | Each method will return $this, so you can stop at any call. -------------------------------------------------------------------------------- /content/tips/create-helper-functions-for-creating-models-in-tests-using-factories.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create helper functions for creating models in tests using factories' 3 | tweet_id: 1425833852480626694 4 | thread_slug: pest-tips 5 | author_username: archtechx 6 | images: 7 | - https://pbs.twimg.com/media/E8mO3a5VEAAsjr1.jpg 8 | created_at: 2021-08-16T19:07:22+02:00 9 | slug: create-helper-functions-for-creating-models-in-tests-using-factories 10 | --- 11 | For example: 12 | - invoice() to create an Invoice model 13 | - product() to create a Product model 14 | -------------------------------------------------------------------------------- /content/tips/create-helper-functions.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create helper functions' 3 | tweet_id: '1272822457011970048' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean1ow4WoAAFjoT.jpg' 8 | created_at: 2020-06-16T09:24:56+00:00 9 | slug: create-helper-functions 10 | --- 11 | 12 | If you repeat some code a lot, consider if extracting it to a helper function would make the code cleaner. -------------------------------------------------------------------------------- /content/tips/create-methods-for-complex-conditionals.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create methods for complex conditionals' 3 | tweet_id: '1498010809179332609' 4 | thread_slug: weekly-thread-2022-08 5 | author_username: enunomaduro 6 | images: 7 | - 'https://pbs.twimg.com/media/FMI11QtXMAUnCID.jpg' 8 | created_at: 2022-02-27T19:03:03+00:00 9 | slug: create-methods-for-complex-conditionals 10 | --- 11 | Encapsulating complex conditionals offering a "callable" API is sexy AF. 🍑 -------------------------------------------------------------------------------- /content/tips/create-model-methods-for-business-logic.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create model methods for business logic' 3 | tweet_id: '1272822448145272832' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean0WGiWAAAg4cu.jpg' 8 | created_at: 2020-06-16T09:24:54+00:00 9 | slug: create-model-methods-for-business-logic 10 | --- 11 | 12 | Your controllers should be simple. They should say things like "create invoice for order". They shouldn't be concerned with the details of how your database is structured. 13 | 14 | Leave that to the model. -------------------------------------------------------------------------------- /content/tips/create-query-scopes-for-complex-wheres.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create query scopes for complex where()s' 3 | tweet_id: '1272826431609933825' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean5ymtXgAEvlxm.jpg' 8 | created_at: 2020-06-16T09:40:43+00:00 9 | slug: create-query-scopes-for-complex-wheres 10 | --- 11 | 12 | Rather than writing complex where() clauses, create query scopes with expressive names. 13 | 14 | This will make your e.g. controllers have to know less about the database structure and your code will be cleaner. -------------------------------------------------------------------------------- /content/tips/create-renderable-exceptions.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create renderable exceptions' 3 | tweet_id: '1461703839388626946' 4 | thread_slug: weekly-thread-2021-46 5 | author_username: Philo01 6 | images: 7 | - 'https://pbs.twimg.com/media/FEewo1NXMAgaMbb.jpg' 8 | created_at: 2021-11-19T14:32:07+00:00 9 | slug: create-renderable-exceptions 10 | --- 11 | Laravel Tip: You can customize how your exceptions are rendered by adding a 'render' method to your exception. 12 | 13 | For example, this allows you to return JSON instead of a Blade view when the request expects JSON. -------------------------------------------------------------------------------- /content/tips/create-single-use-blade-includes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create single-use Blade includes' 3 | tweet_id: '1272826427902234625' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: { } 7 | created_at: 2020-06-16T09:40:43+00:00 8 | slug: create-single-use-blade-includes 9 | --- 10 | 11 | Similar to single-use traits. 12 | 13 | This tactic is great when you have a very long template and you want to make it more manageable. 14 | 15 | There's nothing wrong with @including headers and footers in layouts, or things like complex forms in page views. -------------------------------------------------------------------------------- /content/tips/create-single-use-traits.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create single-use traits' 3 | tweet_id: '1272822478260363265' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean5BnEWkAEPUTe.jpg' 8 | created_at: 2020-06-16T09:25:01+00:00 9 | slug: create-single-use-traits 10 | --- 11 | 12 | Adding methods to classes where they belong is cleaner than creating action classes for everything, but it can make the classes grow big 13 | 14 | Consider using traits. They're meant *primarily* for code reuse, but there's nothing wrong with single-use traits -------------------------------------------------------------------------------- /content/tips/create-this-tinker-bash-script-to-supercharge-your-dev-workflow.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create this `tinker` bash script to supercharge your dev workflow' 3 | tweet_id: '1451526385982447647' 4 | thread_slug: weekly-thread-2021-42 5 | author_username: Philo01 6 | images: 7 | - 'https://pbs.twimg.com/media/FB1A012WYAILmTL.jpg' 8 | created_at: 2021-10-22T12:30:33+00:00 9 | slug: create-this-tinker-bash-script-to-supercharge-your-dev-workflow 10 | --- 11 | Laravel productivity tip! Add this little function to your bash profile to quickly execute anything with the Tinker command and get the results instantly. 12 | -------------------------------------------------------------------------------- /content/tips/create-variables-when-they-improve-readability.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Create variables when they improve readability' 3 | tweet_id: '1272822446278750208' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean0HJwWAAAZkDR.png' 8 | created_at: 2020-06-16T09:24:53+00:00 9 | slug: create-variables-when-they-improve-readability 10 | --- 11 | 12 | The opposite of the previous tip. Sometimes the value comes from a complex call and as such, creating a variable improves readability & removes the need for a comment. 13 | 14 | Remember that context matters & your end goal is readability -------------------------------------------------------------------------------- /content/tips/custom-collections-pair-well-with-higher-order-proxies.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Custom collections pair well with higher order proxies' 3 | tweet_id: '1479467951753285637' 4 | thread_slug: weekly-thread-2022-01 5 | author_username: archtechx 6 | images: 7 | - 'https://pbs.twimg.com/media/FIa84E5VUAAQsL1.jpg' 8 | created_at: 2022-01-07T15:00:21+00:00 9 | slug: custom-collections-pair-well-with-higher-order-proxies 10 | --- 11 | 🔥 Custom collections pair very well with higher order proxies 12 | 13 | When you have some repetitive low level logic that you'd like to abstract into more readable methods that follow your business terminology, custom collections can be a great choice 14 | -------------------------------------------------------------------------------- /content/tips/custom-response-effects.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Custom response effects' 3 | tweet_id: '' 4 | thread_slug: obscure-livewire-tips 5 | author_username: samuelstancl 6 | images: 7 | - 'https://cln.sh/YjzF2w/download' 8 | created_at: 2021-04-09T17:22:56+02:00 9 | slug: custom-response-effects 10 | --- 11 | 12 | You can add custom data to response effects. Those are separate from component data, and act more like events. 13 | 14 | You can use them when you have some JS code that looks at Livewire responses, and when you want more control than dispatching browser events 15 | -------------------------------------------------------------------------------- /content/tips/dedicate-a-weekend-towards-learning-proper-oop.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Dedicate a weekend towards learning proper OOP' 3 | tweet_id: '1272822460631539712' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: { } 7 | created_at: 2020-06-16T09:24:57+00:00 8 | slug: dedicate-a-weekend-towards-learning-proper-oop 9 | --- 10 | 11 | Know the difference between static/instance methods & variables and private/protected/public visibility. Also learn how Laravel uses magic methods. 12 | 13 | You don't need this as a beginner, but as your code grows, it's crucial. -------------------------------------------------------------------------------- /content/tips/dont-create-variables-when-you-can-just-pass-the-value-directly.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Don''t create variables when you can just pass the value directly' 3 | tweet_id: '1272822444621991937' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Eanz9WJWkAAeoT2.jpg' 8 | created_at: 2020-06-16T09:24:53+00:00 9 | slug: dont-create-variables-when-you-can-just-pass-the-value-directly 10 | --- 11 | -------------------------------------------------------------------------------- /content/tips/dont-just-write-procedural-code-in-classes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Don''t just write procedural code in classes' 3 | tweet_id: '1272822462040899584' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean2u-YX0AEmwEd.jpg' 8 | created_at: 2020-06-16T09:24:57+00:00 9 | slug: dont-just-write-procedural-code-in-classes 10 | --- 11 | 12 | This ties the previous tweet with the other tips here. OOP exists to make your code more readable, use it. Don't just write 400 line long procedural code in controller actions. 13 | 14 | Here's code from my first Laravel project 😬 -------------------------------------------------------------------------------- /content/tips/dont-split-lines-at-random-places-but-dont-make-them-too-long-either.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Don''t split lines at random places, but don''t make them too long either' 3 | tweet_id: '1272822442990473216' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Eanz0jnXsAAvkv1.jpg' 8 | created_at: 2020-06-16T09:24:52+00:00 9 | slug: dont-split-lines-at-random-places-but-dont-make-them-too-long-either 10 | --- 11 | 12 | Opening an array with [ and indenting the values tends to work well. Same with long function parameter values. 13 | 14 | Other good places to split lines are chained calls and closures. -------------------------------------------------------------------------------- /content/tips/dont-use-a-controller-namespace.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Don''t use a controller namespace' 3 | tweet_id: '1272826437167468544' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean6NFJX0AAfiXT.png' 8 | created_at: 2020-06-16T09:40:45+00:00 9 | slug: dont-use-a-controller-namespace 10 | --- 11 | 12 | Instead of writing controller actions like PostController@index, use the callable array syntax [PostController::class, 'index']. 13 | 14 | You will be able to navigate to the class by clicking PostController. -------------------------------------------------------------------------------- /content/tips/dont-use-abbreviations.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Don''t use abbreviations' 3 | tweet_id: '1272822472329572355' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean4TBBXgAAMab3.png' 8 | created_at: 2020-06-16T09:24:59+00:00 9 | slug: dont-use-abbreviations 10 | --- 11 | 12 | Don't think that long variable/method names are wrong. They're not. They're expressive. 13 | 14 | Better to call a longer method than a short one and check the docblock to understand what it does 15 | 16 | Same with variables. Don't use nonsense 3-letters abbreviations -------------------------------------------------------------------------------- /content/tips/dont-use-model-methods-to-retrieve-data.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Don''t use model methods to retrieve data' 3 | tweet_id: '1272826433417752576' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean58GjWAAAgqLq.jpg' 8 | created_at: 2020-06-16T09:40:44+00:00 9 | slug: dont-use-model-methods-to-retrieve-data 10 | --- 11 | 12 | If you want to retrieve some data from a model, create an accessor. 13 | 14 | Keep methods for things that *change* the model in some way. -------------------------------------------------------------------------------- /content/tips/dump-and-dd-are-available-on-the-eloquent-query-builder.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'dump() and dd() are available on the Eloquent Query Builder ' 3 | tweet_id: '1550466500288397313' 4 | thread_slug: weekly-thread-2022-29 5 | author_username: ecrmnn 6 | images: 7 | - 'https://pbs.twimg.com/media/FX9mC2ZUUAEM7Nn.jpg' 8 | created_at: 2022-07-22T13:03:14+00:00 9 | slug: dump-and-dd-are-available-on-the-eloquent-query-builder 10 | --- 11 | TIL, in Laravel you can display debug information about the current query with dump() and dd() 🤙 12 | 13 | This allows you to see the underlying query and bindings. -------------------------------------------------------------------------------- /content/tips/eloquent-listeners-are-awesome.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Eloquent listeners are awesome' 3 | tweet_id: '1308114698299154433' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidaLtrXcAU0nIG.png' 8 | created_at: 2020-09-21T18:43:42+00:00 9 | slug: eloquent-listeners-are-awesome 10 | --- 11 | 12 | Example: Default value set on creation. -------------------------------------------------------------------------------- /content/tips/encrypted-casts-can-use-unique-model-derived-keys.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Encrypted casts can use unique model-derived keys' 3 | tweet_id: '1542863733004767234' 4 | thread_slug: weekly-thread-2022-26 5 | author_username: mattkingshott 6 | images: 7 | - 'https://pbs.twimg.com/media/FWazRABX0AAps0t.jpg' 8 | created_at: 2022-07-01T13:32:33+00:00 9 | slug: encrypted-casts-can-use-unique-model-derived-keys 10 | --- 11 | 🔥 #Laravel Tip: 12 | 13 | The default encryption cast for Eloquent models uses the app key, making rotation difficult and allowing anyone with key to decrypt all the DB. To address this, consider creating a custom cast that uses the model to create its own unique key. -------------------------------------------------------------------------------- /content/tips/example-checking-a-parent-relationship-for-some-things.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Example: Checking a parent relationship for some things' 3 | tweet_id: '1308114701415571457' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidbX_UWAAMeB6-.png' 8 | created_at: 2020-09-21T18:43:43+00:00 9 | slug: example-checking-a-parent-relationship-for-some-things 10 | --- 11 | 12 | Such as, checking if an Order is locked inside an OrderProduct. 13 | 14 | OrderProducts cannot be added to/changed in a locked order. -------------------------------------------------------------------------------- /content/tips/example-deleting-associated-files-on-deletion.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Example: Deleting associated files on deletion' 3 | tweet_id: '1308114699913961472' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidbEGZXYAA6q3G.png' 8 | created_at: 2020-09-21T18:43:42+00:00 9 | slug: example-deleting-associated-files-on-deletion 10 | --- 11 | -------------------------------------------------------------------------------- /content/tips/extract-methods.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Extract methods' 3 | tweet_id: '1272822455393026049' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean1UORWkAE4UDD.jpg' 8 | created_at: 2020-06-16T09:24:55+00:00 9 | slug: extract-methods 10 | --- 11 | 12 | If some method is too long or complex, and it's hard to understand what exactly is happening, split the logic into multiple methods. -------------------------------------------------------------------------------- /content/tips/form-elements-can-have-a-target-attribute-which-works-very-similarly-to-ltagt-tags.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Form elements can have a "target" attribute which works very similarly to <a> tags' 3 | tweet_id: '1482036555883560961' 4 | thread_slug: weekly-thread-2022-02 5 | author_username: jbrooksuk 6 | images: 7 | - 'https://pbs.twimg.com/media/FI-ZzcDWQAED8P2.jpg' 8 | created_at: 2022-01-14T17:07:04+00:00 9 | slug: form-elements-can-have-a-target-attribute-which-works-very-similarly-to-ltagt-tags 10 | --- 11 | Did you know that "form" elements can have a "target" attribute too? -------------------------------------------------------------------------------- /content/tips/from-php-74-you-can-use-the-spread-syntax-to-merge-arrays.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'From PHP 7.4, you can use the spread syntax to merge arrays' 3 | tweet_id: '1479467945822588931' 4 | thread_slug: weekly-thread-2022-01 5 | author_username: bhaidar 6 | images: 7 | - 'https://pbs.twimg.com/media/FIDdCQvVEAMsK3l.jpg' 8 | created_at: 2022-01-07T15:00:20+00:00 9 | slug: from-php-74-you-can-use-the-spread-syntax-to-merge-arrays 10 | --- 11 | 🌶️ #PHP tip: Did you know that you can use the spread operator to merge arrays, just like you do it in #javascript? 12 | 13 | Available since PHP 7.4+ 14 | 15 | #Laravel 16 | -------------------------------------------------------------------------------- /content/tips/have-a-single-source-of-truth-for-validation-rules.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Have a single source of truth for validation rules' 3 | tweet_id: '1272826456960315392' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: { } 7 | created_at: 2020-06-16T09:40:49+00:00 8 | slug: have-a-single-source-of-truth-for-validation-rules 9 | --- 10 | 11 | If you validate some resource's attributes on multiple places, you definitely want to centralize these validation rules, so that you don't change them in one place but forget about the other places. 12 | 13 | https://twitter.com/LiamHammett/status/1260252814158282752 -------------------------------------------------------------------------------- /content/tips/heres-another-example-of-the-model-state-stuff-mentioned-above.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Here''s another example of the Model state stuff mentioned above' 3 | tweet_id: '1308088600278560768' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidDSDcXYAA_7XD.jpg' 8 | created_at: 2020-09-21T17:00:00+00:00 9 | slug: heres-another-example-of-the-model-state-stuff-mentioned-above 10 | --- 11 | 12 | Except... 13 | 14 | It's multi-tenant! 15 | 16 | Tip 7: It's incredibly easy to use http://tenancyforlaravel.com with Tinker 😎 -------------------------------------------------------------------------------- /content/tips/higher-order-messages-are-a-great-way-to-tidy-up-long-collection-logic.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Higher-order messages are a great way to tidy up long collection logic' 3 | tweet_id: '1487081947864002572' 4 | thread_slug: weekly-thread-2022-04 5 | author_username: alexjgarrett 6 | images: 7 | - 'https://pbs.twimg.com/media/FKD7ajmXIAAEjTW.jpg' 8 | created_at: 2022-01-28T15:15:39+00:00 9 | slug: higher-order-messages-are-a-great-way-to-tidy-up-long-collection-logic 10 | --- 11 | Sometimes I forget about higher order collection messages in Laravel, but they're a great way to shorten and tidy up your code ✨ 12 | 13 | Here's a simplified (and not recommended) example. -------------------------------------------------------------------------------- /content/tips/if-you-dont-like-the-double-indentation-of-vue-data-you-can-use-arrow-functions.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'If you don''t like the "double indentation" of Vue data(), you can use arrow functions' 3 | tweet_id: '1285486044561969154' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Edb2vN0XoAEnunt.png' 8 | - 'https://pbs.twimg.com/media/Edb2vO8WoAAAcdX.png' 9 | created_at: 2020-07-21T08:05:30+00:00 10 | slug: if-you-dont-like-the-double-indentation-of-vue-data-you-can-use-arrow-functions 11 | --- 12 | 13 | Left: double nesting 14 | Right: arrow function -------------------------------------------------------------------------------- /content/tips/if-you-use-both-pest-and-phpunit-you-can-use-both-syntaxes-in-both-types-of-tests.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'If you use both pest and PHPUnit, you can use both syntaxes in both types of tests' 3 | tweet_id: '1507455564942495749' 4 | thread_slug: weekly-thread-2022-12 5 | author_username: djgeisi 6 | images: 7 | - 'https://pbs.twimg.com/media/FOUNAdFXMAQI7RA.jpg' 8 | created_at: 2022-03-25T20:33:08+00:00 9 | slug: if-you-use-both-pest-and-phpunit-you-can-use-both-syntaxes-in-both-types-of-tests 10 | --- 11 | #PestPHP #PHP Tip 12 | 13 | If you have a mixed codebase with Pest and PHPUnit tests you can use almost all of the pest magic in your PHPUnit tests. 14 | It just works. -------------------------------------------------------------------------------- /content/tips/implement-the-tostring-method-in-a-class-to-specify-custom-logic-for-converting-its-instances-to-strings.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Implement the __toString() method in a class to specify custom logic for converting its instances to strings' 3 | tweet_id: '1454133805745385473' 4 | thread_slug: weekly-thread-2021-43 5 | author_username: enunomaduro 6 | images: 7 | - 'https://pbs.twimg.com/media/FCx22U5WQAYOWi4.jpg' 8 | created_at: 2021-10-29T17:11:30+00:00 9 | slug: implement-the-tostring-method-in-a-class-to-specify-custom-logic-for-converting-its-instances-to-strings 10 | --- 11 | PHP reminder: you can use the method "__toString()" to specify the string representation of an object. ✅ -------------------------------------------------------------------------------- /content/tips/import-namespaces-instead-of-using-aliases.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Import namespaces instead of using aliases' 3 | tweet_id: '1272826429483495424' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean5otqXYAA4QPR.png' 8 | created_at: 2020-06-16T09:40:43+00:00 9 | slug: import-namespaces-instead-of-using-aliases 10 | --- 11 | 12 | Sometimes you may have multiple classes with the same name. Rather than importing them with an alias, import the namespaces. -------------------------------------------------------------------------------- /content/tips/in-laravel-9-you-can-use-str-instead-of-strof.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'In Laravel 9, you can use str() instead of Str::of()' 3 | tweet_id: '1494019557249335296' 4 | thread_slug: weekly-thread-2022-06 5 | author_username: jasonlbeggs 6 | images: 7 | - 'https://pbs.twimg.com/media/FLKjhn4XMAIZqNI.png' 8 | created_at: 2022-02-16T18:43:14+00:00 9 | slug: in-laravel-9-you-can-use-str-instead-of-strof 10 | --- 11 | The `str` helper in @laravelphp v9 is 🔥 12 | -------------------------------------------------------------------------------- /content/tips/in-scheduled-tasks-you-can-use-onsuccess-and-onfailure-callbacks.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'In scheduled tasks, you can use `onSuccess` and `onFailure` callbacks' 3 | tweet_id: '1515057395763798018' 4 | thread_slug: weekly-thread-2022-15 5 | author_username: cosmeescobedo 6 | images: 7 | - 'https://pbs.twimg.com/media/FQAK8H-XEAMWMMT.jpg' 8 | created_at: 2022-04-15T20:00:06+00:00 9 | slug: in-scheduled-tasks-you-can-use-onsuccess-and-onfailure-callbacks 10 | --- 11 | 🔥 Laravel Tip: You can specify what to do if a scheduled task fails or succeeds. -------------------------------------------------------------------------------- /content/tips/interesting-technique-add-getters-to-form-requests.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Interesting technique: add getters to Form Requests' 3 | tweet_id: '1484566716403183617' 4 | thread_slug: weekly-thread-2022-03 5 | author_username: mmartin_joo 6 | images: 7 | - 'https://pbs.twimg.com/media/FJYsa1fXMAQQlEr.jpg' 8 | created_at: 2022-01-21T16:41:01+00:00 9 | slug: interesting-technique-add-getters-to-form-requests 10 | --- 11 | 💪Power up your #Laravel requests 12 | 13 | You can add very simple getters on the request, so: 14 | ✅You actually know what's on the request 15 | ✅You have types 16 | ✅You can do basic data transformation -------------------------------------------------------------------------------- /content/tips/isset-accepts-multiple-arguments.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'isset() accepts multiple arguments' 3 | tweet_id: '1507455541072728066' 4 | thread_slug: weekly-thread-2022-12 5 | author_username: laravelnews 6 | images: 7 | - 'https://pbs.twimg.com/media/FOqbrYAX0AgsSNL.jpg' 8 | created_at: 2022-03-25T20:33:02+00:00 9 | slug: isset-accepts-multiple-arguments 10 | --- 11 | It's a minor thing but the PHP `isset` function can accept multiple vars. https://www.instagram.com/p/CbctwMxgPv4/ -------------------------------------------------------------------------------- /content/tips/its-about-the-micro.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'It''s about the *micro*' 3 | tweet_id: '1272822438406094848' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: { } 7 | created_at: 2020-06-16T09:24:51+00:00 8 | slug: its-about-the-micro 9 | --- 10 | 11 | Using some "macro" philosophy for structuring your code, like hexagonal architecture or DDD won't save you. 12 | 13 | A clean codebase is the result of constant good decisions at the micro level. -------------------------------------------------------------------------------- /content/tips/keep-validation-rules-inside-models-to-make-your-code-more-consistent-and-clean.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Keep validation rules inside models to make your code more consistent and clean' 3 | tweet_id: '1469321060604514304' 4 | thread_slug: weekly-thread-2021-49 5 | author_username: archtechx 6 | images: { } 7 | created_at: 2021-12-10T15:00:14+00:00 8 | slug: keep-validation-rules-inside-models-to-make-your-code-more-consistent-and-clean 9 | --- 10 | This pattern is brilliant and can make your code much more clean and consistent 11 | 12 | The tweet is from last year, but it's still very relevant 13 | 14 | https://twitter.com/LiamHammett/status/1260252814158282752 -------------------------------------------------------------------------------- /content/tips/laravel-9-can-automatically-bind-route-parameters-to-enums.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Laravel 9 can automatically bind route parameters to enums' 3 | tweet_id: '1494019551310139392' 4 | thread_slug: weekly-thread-2022-06 5 | author_username: mmartin_joo 6 | images: 7 | - 'https://pbs.twimg.com/media/FLJ8Gt_XsAM98uy.jpg' 8 | created_at: 2022-02-16T18:43:13+00:00 9 | slug: laravel-9-can-automatically-bind-route-parameters-to-enums 10 | --- 11 | 🔥Laravel 9 introduced enum route bindings! 12 | 13 | You can type-hint your enum and Laravel will cast the string value from the URL: 14 | -------------------------------------------------------------------------------- /content/tips/laravel-can-automatically-notify-you-by-email-when-a-scheduled-job-fails.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Laravel can automatically notify you by email when a scheduled job fails' 3 | tweet_id: '1464247630377021448' 4 | thread_slug: weekly-thread-2021-47 5 | author_username: mattkingshott 6 | images: 7 | - 'https://pbs.twimg.com/media/FE3z7XuXsAA-RJk.jpg' 8 | created_at: 2021-11-26T15:00:14+00:00 9 | slug: laravel-can-automatically-notify-you-by-email-when-a-scheduled-job-fails 10 | --- 11 | 💡#Laravel Tip: Did you know that any commands you schedule in the console kernel can automatically email their output if something goes wrong. -------------------------------------------------------------------------------- /content/tips/laravel-migrations-have-a-very-nice-syntax-for-foreign-keys.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Laravel migrations have a very nice syntax for foreign keys' 3 | tweet_id: '1308126491188883463' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: { } 7 | created_at: 2020-09-21T19:30:33+00:00 8 | slug: laravel-migrations-have-a-very-nice-syntax-for-foreign-keys 9 | --- 10 | 11 | I didn't know about this for so long. 12 | 13 | Instead of: 14 | $table->unsignedBigInteger('user_id'); 15 | $table->foreign('user_id')->references('id')->on('users'); 16 | 17 | You do: 18 | $table->foreignId('user_id')->constrained(); -------------------------------------------------------------------------------- /content/tips/laravel-nova-lets-you-show-different-resourcestoolscards-based-on-an-if-check.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Laravel Nova lets you show different resources/tools/cards/... based on an if check' 3 | tweet_id: '1308084774586773510' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidABmBXcAAto9_.png' 8 | created_at: 2020-09-21T16:44:47+00:00 9 | slug: laravel-nova-lets-you-show-different-resourcestoolscards-based-on-an-if-check 10 | --- 11 | 12 | Extremely handy when you have multiple admin panels in a single app. -------------------------------------------------------------------------------- /content/tips/laravel-telescope-is-great-for-so-many-things.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Laravel Telescope is great for so many things' 3 | tweet_id: '1308094765544734720' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidI3vCXgAIOCvY.png' 8 | created_at: 2020-09-21T17:24:29+00:00 9 | slug: laravel-telescope-is-great-for-so-many-things 10 | --- 11 | 12 | One of them is examining sent emails ✉️ 13 | 14 | You usually don't need a service like Mailtrap. Just use the `log` mail driver and install Telescope. 15 | 16 | (image stolen from the internet) -------------------------------------------------------------------------------- /content/tips/laravels-http-client-supports-concurrent-requests-using-the-pool-method.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Laravel''s Http client supports concurrent requests using the `pool` method' 3 | tweet_id: '1484566722526924801' 4 | thread_slug: weekly-thread-2022-03 5 | author_username: mattkingshott 6 | images: 7 | - 'https://pbs.twimg.com/media/FJdr42eWQAcEVKh.jpg' 8 | created_at: 2022-01-21T16:41:03+00:00 9 | slug: laravels-http-client-supports-concurrent-requests-using-the-pool-method 10 | --- 11 | 🔥 #Laravel Tip: Need to make more than one HTTP request e.g. to one or more sites? You might think about running them concurrently to improve performance. The HTTP client's 'pool' method makes this a trivial exercise. -------------------------------------------------------------------------------- /content/tips/laravels-ratelimiter-can-be-used-to-throttle-any-parts-of-your-code.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Laravel''s RateLimiter can be used to throttle ANY parts of your code' 3 | tweet_id: '1542863730194538496' 4 | thread_slug: weekly-thread-2022-26 5 | author_username: mattkingshott 6 | images: 7 | - 'https://pbs.twimg.com/media/FWflzWuWYAAyvkB.jpg' 8 | created_at: 2022-07-01T13:32:32+00:00 9 | slug: laravels-ratelimiter-can-be-used-to-throttle-any-parts-of-your-code 10 | --- 11 | 🔥 #Laravel Tip: Rate-limiting is not only for throttling entire requests. You can also use it to throttle methods or parts of your code, which can be really useful when you need to protect things against spikes e.g. the DB. -------------------------------------------------------------------------------- /content/tips/laravels-slack-logging-channel-is-fully-compatible-with-discord.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Laravel''s Slack logging channel is fully compatible with Discord' 3 | tweet_id: '1484566698069876740' 4 | thread_slug: weekly-thread-2022-03 5 | author_username: LarsKlopstra 6 | images: 7 | - 'https://pbs.twimg.com/media/FJjSoysWUAI-HBq.jpg' 8 | created_at: 2022-01-21T16:40:57+00:00 9 | slug: laravels-slack-logging-channel-is-fully-compatible-with-discord 10 | --- 11 | 🤖🧠 Want to log errors or user activity to Discord? You can use the Slack driver to send Slack compatible webhooks to Discord! -------------------------------------------------------------------------------- /content/tips/livewire-readonly-properties.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Readonly properties' 3 | tweet_id: '' 4 | thread_slug: obscure-livewire-tips 5 | author_username: samuelstancl 6 | images: 7 | - 'https://cln.sh/oG5FqU/download' 8 | created_at: 2021-04-09T17:28:56+02:00 9 | slug: livewire-readonly-properties 10 | --- 11 | 12 | They're a great way to make your components safer and faster. 13 | 14 | Say you have a component for editing some resource. 15 | 16 | You enforce the ACL in mount(). 17 | 18 | But if the user could change the currently edited resource, you'd need to enforce ACL on *all* requests! 19 | -------------------------------------------------------------------------------- /content/tips/long-classes-can-be-split-into-small-single-use-traits.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Long classes can be split into small single-use traits' 3 | tweet_id: '1538579137463406592' 4 | thread_slug: weekly-thread-2022-24 5 | author_username: archtechx 6 | images: 7 | - 'https://pbs.twimg.com/media/FVSanUMUcAA5iRg.jpg' 8 | created_at: 2022-06-19T17:47:06+00:00 9 | slug: long-classes-can-be-split-into-small-single-use-traits 10 | --- 11 | 💡 Create single-use traits to split up long classes into smaller parts 12 | 13 | This way, all e.g. link-related logic can be contained within a single trait -------------------------------------------------------------------------------- /content/tips/make-laravel-send-all-emails-to-a-specific-email-address-using-mailalwaysto.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Make Laravel send all emails to a specific email address using Mail::alwaysTo()' 3 | tweet_id: '1484566719574130689' 4 | thread_slug: weekly-thread-2022-03 5 | author_username: fideloper 6 | images: 7 | - 'https://pbs.twimg.com/media/FJkqAzmXMAA5tlg.jpg' 8 | created_at: 2022-01-21T16:41:02+00:00 9 | slug: make-laravel-send-all-emails-to-a-specific-email-address-using-mailalwaysto 10 | --- 11 | Just got schooled in a Laravel feature I was unaware of: 12 | 13 | Tell Laravel to always send to a specific address! -------------------------------------------------------------------------------- /content/tips/make-models-prunable-to-periodically-delete-them-from-the-db.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Make models prunable to periodically delete them from the DB' 3 | tweet_id: '1484566701089849344' 4 | thread_slug: weekly-thread-2022-03 5 | author_username: mmartin_joo 6 | images: 7 | - 'https://pbs.twimg.com/media/FJTZyx9XEAcctdk.jpg' 8 | created_at: 2022-01-21T16:40:58+00:00 9 | slug: make-models-prunable-to-periodically-delete-them-from-the-db 10 | --- 11 | 💡#Laravel Eloquent Tip 12 | 13 | Laravel 8 introduced the Prunable trait. You can use it to delete old models on a scheduled basis. 14 | 15 | You don't need to write custom commands anymore: -------------------------------------------------------------------------------- /content/tips/match-statements-are-a-great-way-to-clean-up-code.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'match() statements are a great way to clean up code' 3 | tweet_id: '1489620168233734144' 4 | thread_slug: weekly-thread-2022-05 5 | author_username: cerbero90 6 | images: 7 | - 'https://pbs.twimg.com/media/FKqzQ68aMAAqGdX.png' 8 | created_at: 2022-02-04T15:21:38+00:00 9 | slug: match-statements-are-a-great-way-to-clean-up-code 10 | --- 11 | Match offers such a compact and clean syntax compared to its PHP alternatives 🌈 12 | 13 | It can make our code way more readable and concise 💅 14 | 15 | #PHP 16 | -------------------------------------------------------------------------------- /content/tips/method-parameters-can-be-marked-as-sensitive.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Method parameters can be marked as "sensitive”' 3 | tweet_id: '1538579129276059648' 4 | thread_slug: weekly-thread-2022-24 5 | author_username: SteveTheBauman 6 | images: 7 | - 'https://pbs.twimg.com/media/FVZSWpkXwAITTAp.jpg' 8 | created_at: 2022-06-19T17:47:04+00:00 9 | slug: method-parameters-can-be-marked-as-sensitive 10 | --- 11 | Apparently in PHP 8.2, you can mark method parameters as "sensitive" so that they are not printed in debug_backtrace 🤯 12 | 13 | https://php.watch/versions/8.2/backtrace-parameter-redaction -------------------------------------------------------------------------------- /content/tips/move-tests-to-separate-test-suites.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Move tests to separate test suites' 3 | tweet_id: '1495414937757253636' 4 | thread_slug: weekly-thread-2022-07 5 | author_username: JackEllis 6 | images: 7 | - 'https://pbs.twimg.com/media/FLVuSJRVQAEQffe.jpg' 8 | created_at: 2022-02-20T15:07:59+00:00 9 | slug: move-tests-to-separate-test-suites 10 | --- 11 | 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. -------------------------------------------------------------------------------- /content/tips/mysql-has-a-blackhole-store-engine.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'MySQL has a blackhole store engine' 3 | tweet_id: '1484566725597138944' 4 | thread_slug: weekly-thread-2022-03 5 | author_username: fideloper 6 | images: 7 | - 'https://pbs.twimg.com/media/FJklJacX0AIsUP1.jpg' 8 | created_at: 2022-01-21T16:41:03+00:00 9 | slug: mysql-has-a-blackhole-store-engine 10 | --- 11 | 👨‍🔬 Cool MySQL hack: 12 | 13 | 🧐 If your staging env has a table that ideally doesn't have data in it (esp production data) 14 | 15 | 🕳 You can make it a BLACKHOLE table 16 | 17 | 😅 I used this to make sure a table with a list of emails to send never contains any rows. Because, you know.... -------------------------------------------------------------------------------- /content/tips/name-all-timestamp-fields-using-the-action-at-convention.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Name *all* timestamp fields using the action_at convention' 3 | tweet_id: '1498010797083009025' 4 | thread_slug: weekly-thread-2022-08 5 | author_username: AshAllenDesign 6 | images: 7 | - 'https://pbs.twimg.com/media/FLy78SOXsAMRB2g.jpg' 8 | created_at: 2022-02-27T19:03:00+00:00 9 | slug: name-all-timestamp-fields-using-the-action-at-convention 10 | --- 11 | Laravel tip: Use the "{action}_at" naming convention for your DATETIME and TIMESTAMP fields. 12 | 13 | This helps you to instantly recognise in your code when you're using a datetime field 😄 14 | 15 | #laravel #php -------------------------------------------------------------------------------- /content/tips/name-contracts-as-descriptors-and-implementations-as-orders.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Name contracts as descriptors and implementations as orders' 3 | tweet_id: '1494019563490402305' 4 | thread_slug: weekly-thread-2022-06 5 | author_username: MikeVILT 6 | images: 7 | - 'https://pbs.twimg.com/media/FLKZjZbXMAQ18WD.jpg' 8 | created_at: 2022-02-16T18:43:16+00:00 9 | slug: name-contracts-as-descriptors-and-implementations-as-orders 10 | --- 11 | A great tip from Luke @LukeDowning19, 12 | 13 | "Name contracts as descriptions and implementations as orders" 14 | 15 | #laracon 16 | -------------------------------------------------------------------------------- /content/tips/number-markdown-lists-with-1-rather-than-the-actual-number.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Number markdown lists with `1.` rather than the actual number' 3 | tweet_id: '1479467929888440329' 4 | thread_slug: weekly-thread-2022-01 5 | author_username: frankdejonge 6 | images: 7 | - 'https://pbs.twimg.com/media/FHNHLM8X0AA6sqs.png' 8 | created_at: 2022-01-07T15:00:16+00:00 9 | slug: number-markdown-lists-with-1-rather-than-the-actual-number 10 | --- 11 | 💡 A little thing I always like to do. Use only "1." for numbered lists in markdown. The list is rendered the same, but adding an item doesn't require you to renumber the other items 🤘 12 | -------------------------------------------------------------------------------- /content/tips/orderbyraw-is-very-useful-for-complex-sorting-in-eloquent.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'orderByRaw() is very useful for complex sorting in Eloquent' 3 | tweet_id: '1527688616838803456' 4 | thread_slug: weekly-thread-2022-20 5 | author_username: mattkingshott 6 | images: 7 | - 'https://pbs.twimg.com/media/FS-AaRbWAAA5Xfl.jpg' 8 | created_at: 2022-05-20T16:32:03+00:00 9 | slug: orderbyraw-is-very-useful-for-complex-sorting-in-eloquent 10 | --- 11 | 🔥 #Laravel Tip: Make use of ‘orderByRaw’ when you need to sort records in a more complex manner than simply A-Z or Z-A. Here’s an example where I sort ‘roles’ based on their level of importance (rather than their alphabetical order). -------------------------------------------------------------------------------- /content/tips/people-underutilize-the-exception-handler.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'People underutilize the exception handler' 3 | tweet_id: '1308082889561604102' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Eic5sfxWAAY2ym2.png' 8 | created_at: 2020-09-21T16:37:18+00:00 9 | slug: people-underutilize-the-exception-handler 10 | --- 11 | 12 | You can tell the app what response to return when a specific exception is encountered. 13 | 14 | This is the simplest example. There's many more use cases. -------------------------------------------------------------------------------- /content/tips/pest-allows-calling-dd-directly-on-the-expect-chain.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Pest allows calling dd() directly on the expect() chain' 3 | tweet_id: '1507455561918390279' 4 | thread_slug: weekly-thread-2022-12 5 | author_username: enunomaduro 6 | images: 7 | - 'https://pbs.twimg.com/media/FOibegNXsAEKTbb.jpg' 8 | created_at: 2022-03-25T20:33:07+00:00 9 | slug: pest-allows-calling-dd-directly-on-the-expect-chain 10 | --- 11 | Pest tip: Use the `dd` method to dump the current expectation value and end the test suite. 🔦 -------------------------------------------------------------------------------- /content/tips/php-81-enums-can-be-used-as-model-casts.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'PHP 8.1 enums can be used as model casts' 3 | tweet_id: '1479467948985126913' 4 | thread_slug: weekly-thread-2022-01 5 | author_username: ryangjchandler 6 | images: 7 | - 'https://pbs.twimg.com/media/FIRla1cX0AUpxGS.jpg' 8 | created_at: 2022-01-07T15:00:20+00:00 9 | slug: php-81-enums-can-be-used-as-model-casts 10 | --- 11 | 🔥 Did you know that @laravelphp can cast model columns into instances an enum in PHP 8.1? 12 | 13 | The example below will create an instance of `OrderStatus` based on variant value. If the `status` column has the value `shipped`, it will return the `OrderStatus::Shipped` variant. 14 | -------------------------------------------------------------------------------- /content/tips/php-traits-can-contain-abstract-methods.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'PHP traits can contain abstract methods' 3 | tweet_id: '1505269900352258049' 4 | thread_slug: weekly-thread-2022-11 5 | author_username: mmartin_joo 6 | images: 7 | - 'https://pbs.twimg.com/media/FN-wwBiXMAYfW2D.jpg' 8 | created_at: 2022-03-19T19:48:05+00:00 9 | slug: php-traits-can-contain-abstract-methods 10 | --- 11 | 💡Did you know you can write abstract methods in a trait? 12 | 13 | This way you don't have to make assumptions about the models where the trait is used. 14 | 15 | But instead, you have a clear contract: -------------------------------------------------------------------------------- /content/tips/put-migration-names-in-quotes-when-running-makemigration.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Put migration names in quotes when running make:migration' 3 | tweet_id: '1498010806155235328' 4 | thread_slug: weekly-thread-2022-08 5 | author_username: carre_sam 6 | images: 7 | - 'https://pbs.twimg.com/media/FMDWVEAXEAcHEKE.jpg' 8 | created_at: 2022-02-27T19:03:02+00:00 9 | slug: put-migration-names-in-quotes-when-running-makemigration 10 | --- 11 | 👀 Laravel Tip: Save time when typing migration names by using quotes around the name! -------------------------------------------------------------------------------- /content/tips/relevant-for-people-building-packages.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Relevant for people building packages 📦' 3 | tweet_id: '1308086649184751619' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidBy75XsA4CZGx.jpg' 8 | created_at: 2020-09-21T16:52:14+00:00 9 | slug: relevant-for-people-building-packages 10 | --- 11 | 12 | It's IMO better to use static properties and have "self-contained" behavior & configuration. Than to have a billion config keys. Especially when building large packages. 13 | 14 | Makes the package more extensible, by consisting of atomic parts -------------------------------------------------------------------------------- /content/tips/replace-state-with-a-custom-directive.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Replace children with a custom directive' 3 | tweet_id: '' 4 | thread_slug: obscure-livewire-tips 5 | author_username: samuelstancl 6 | images: 7 | - 'https://cln.sh/w6vdHe/download' 8 | created_at: 2021-04-09T17:27:56+02:00 9 | slug: replace-children-with-a-custom-directive 10 | --- 11 | 12 | Imagine that you have a nested component that depends on the parent state. You don't need to sync child state into parent, you just want to replace the child when the parent state changes. 13 | 14 | You can use my custom directive for that. 15 | -------------------------------------------------------------------------------- /content/tips/share-state-using-sprucewire.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Share state with Sprucewire' 3 | tweet_id: '' 4 | thread_slug: obscure-livewire-tips 5 | author_username: samuelstancl 6 | images: {} 7 | created_at: 2021-04-09T17:26:56+02:00 8 | slug: share-state-with-sprucewire 9 | --- 10 | 11 | If you have two components that share some state, and you'd like to keep them in sync in a more effective way than dispatching listeners back and forth, check out Sprucewire. 12 | 13 | It works almost like Vuex for Livewire. 14 | 15 | https://twitter.com/_joshhanley/status/1362646916333334528 16 | -------------------------------------------------------------------------------- /content/tips/specify-container-bindings-using-the-bindings-array.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Specify container bindings using the $bindings array' 3 | tweet_id: '1494019548374126594' 4 | thread_slug: weekly-thread-2022-06 5 | author_username: freekmurze 6 | images: 7 | - 'https://pbs.twimg.com/media/FLKZmOCWYAAq9Hd.jpg' 8 | created_at: 2022-02-16T18:43:12+00:00 9 | slug: specify-container-bindings-using-the-bindings-array 10 | --- 11 | 🔥 Cool tidbit I learned during @LukeDowning19 ’s talk. 12 | 13 | You can add a `$bindings` array to a service provider to bind things. 14 | 15 | https://laravel.com/docs/9.x/providers#the-bindings-and-singletons-properties 16 | #laravel #php 17 | -------------------------------------------------------------------------------- /content/tips/specify-the-columns-you-want-to-select-when-fetching-all-models.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Specify the columns you want to select when fetching all() models' 3 | tweet_id: '1484566713303584774' 4 | thread_slug: weekly-thread-2022-03 5 | author_username: bhaidar 6 | images: 7 | - 'https://pbs.twimg.com/media/FI-ea7zUcAIf9z3.jpg' 8 | created_at: 2022-01-21T16:41:01+00:00 9 | slug: specify-the-columns-you-want-to-select-when-fetching-all-models 10 | --- 11 | 🌶️ #Laravel tip: You can select the columns to run when using the Model::all() method. No need for an additional select() method. 12 | 13 | A tiny tip to always keep in mind 💡 14 | 15 | #PHP #Developers -------------------------------------------------------------------------------- /content/tips/str-gtplural-lets-you-convert-words-to-their-right-form-based-on-a-provided-amount.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'str()->plural() lets you convert words to their right form based on a provided amount' 3 | tweet_id: '1540401129363623936' 4 | thread_slug: weekly-thread-2022-25 5 | author_username: ecrmnn 6 | images: 7 | - 'https://pbs.twimg.com/media/FV3zlAPVEAAWxIr.jpg' 8 | created_at: 2022-06-24T18:27:03+00:00 9 | slug: str-gtplural-lets-you-convert-words-to-their-right-form-based-on-a-provided-amount 10 | --- 11 | Printing a word in singular or plural form depending on the number of items is usually a pain. 12 | 13 | With Laravel Str / Stringable however, it's a breeze 🍃 😍 -------------------------------------------------------------------------------- /content/tips/string-ids-can-be-case-sensitive.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'String IDs can be case sensitive' 3 | tweet_id: '1540401134761701376' 4 | thread_slug: weekly-thread-2022-25 5 | author_username: ecrmnn 6 | images: 7 | - 'https://pbs.twimg.com/media/FVtZhvQUUAYjTE_.jpg' 8 | created_at: 2022-06-24T18:27:04+00:00 9 | slug: string-ids-can-be-case-sensitive 10 | --- 11 | You can make your IDs case sensitive when using strings as primary keys in Laravel ✨ -------------------------------------------------------------------------------- /content/tips/strmask-lets-you-mask-a-portion-of-a-string-with-a-character-eg.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: '`Str::mask()` lets you mask a portion of a string with a character (e.g. *)' 3 | tweet_id: '1596508370952855553' 4 | thread_slug: weekly-thread-2022-35 5 | author_username: PovilasKorop 6 | images: 7 | - 'https://pbs.twimg.com/media/FhCmZ9IX0AAiTED.jpg' 8 | created_at: 2022-11-26T14:17:11+00:00 9 | slug: strmask-lets-you-mask-a-portion-of-a-string-with-a-character-eg 10 | --- 11 | Laravel tip. From Laravel 8.69, there's a "Str::mask()" method which masks a portion of the string with a repeated character like "*". 12 | -------------------------------------------------------------------------------- /content/tips/the-shouldcache-method-lets-you-cache-model-accessor-values.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'The `shouldCache()` method lets you cache model accessor values' 3 | tweet_id: '1515057389950537729' 4 | thread_slug: weekly-thread-2022-15 5 | author_username: cosmeescobedo 6 | images: 7 | - 'https://pbs.twimg.com/media/FQOpEt5VQA0OnWt.jpg' 8 | created_at: 2022-04-15T20:00:04+00:00 9 | slug: the-shouldcache-method-lets-you-cache-model-accessor-values 10 | --- 11 | 🔥 Laravel Tip: Accessor Caching 12 | 13 | As of Laravel 9.6, if you have a computationally intensive accessor, you can use the shouldCache method. -------------------------------------------------------------------------------- /content/tips/the-value-helper-returns-the-passed-value-unless-its-invokable-then-it-first-calls-it.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'The value() helper returns the passed value UNLESS it''s invokable — then it first calls it' 3 | tweet_id: '1487081938623995912' 4 | thread_slug: weekly-thread-2022-04 5 | author_username: marcelpociot 6 | images: 7 | - 'https://pbs.twimg.com/media/FJ-5q6EWQAMKjpX.jpg' 8 | created_at: 2022-01-28T15:15:37+00:00 9 | slug: the-value-helper-returns-the-passed-value-unless-its-invokable-then-it-first-calls-it 10 | --- 11 | I absolutely love the little "value" helper method in @laravelphp as it allows you to create beautiful APIs with ease under the hood. -------------------------------------------------------------------------------- /content/tips/there-are-multiple-ways-to-redirect-users.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'There are multiple ways to redirect users' 3 | tweet_id: '1451526393389621249' 4 | thread_slug: weekly-thread-2021-42 5 | author_username: anwar_nairi 6 | images: 7 | - 'https://pbs.twimg.com/media/FCIjxoBWUAAOHfz.jpg' 8 | created_at: 2021-10-22T12:30:34+00:00 9 | slug: there-are-multiple-ways-to-redirect-users 10 | --- 11 | #Laravel offers various ways to redirect your users ✈️ 12 | -------------------------------------------------------------------------------- /content/tips/this-one-is-less-obscure.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'This one is less obscure' 3 | tweet_id: '1308136547217281026' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidvI20XcAA7MGY.png' 8 | created_at: 2020-09-21T20:10:31+00:00 9 | slug: this-one-is-less-obscure 10 | --- 11 | 12 | The $loop variable. 13 | 14 | It greatly complements Tailwind-styled tables. 15 | 16 | Striped tables done easily 🎉 -------------------------------------------------------------------------------- /content/tips/this-pattern-is-brilliant-and-can-make-your-code-much-more-clean-and-consistent.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'This pattern is brilliant and can make your code much more clean and consistent' 3 | tweet_id: '1468596267458588676' 4 | thread_slug: weekly-thread-2021-49 5 | author_username: LiamHammett 6 | images: 7 | - 'https://pbs.twimg.com/media/EX1RMP1X0AApuv6.jpg' 8 | created_at: 2021-12-08T15:00:10+00:00 9 | slug: this-pattern-is-brilliant-and-can-make-your-code-much-more-clean-and-consistent 10 | --- 11 | 🔥 I often find myself keeping validation rules in a method on the model. This lets me reuse them wherever I may need - including in controllers or form requests. -------------------------------------------------------------------------------- /content/tips/try-to-avoid-unnecessary-nesting-by-returning-a-value-early.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Try to avoid unnecessary nesting by returning a value early' 3 | tweet_id: '1272822441392377856' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EanzmPwXYAAoH2A.jpg' 8 | created_at: 2020-06-16T09:24:52+00:00 9 | slug: try-to-avoid-unnecessary-nesting-by-returning-a-value-early 10 | --- 11 | 12 | Too much nesting & else statements tend to make code harder to read. -------------------------------------------------------------------------------- /content/tips/uploaded-files-can-be-attached-to-emails-directly-from-the-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Uploaded files can be attached to emails directly from the request' 3 | tweet_id: '1538579118551248896' 4 | thread_slug: weekly-thread-2022-24 5 | author_username: ecrmnn 6 | images: 7 | - 'https://pbs.twimg.com/media/FVOf_L_UcAUYEaK.jpg' 8 | created_at: 2022-06-19T17:47:01+00:00 9 | slug: uploaded-files-can-be-attached-to-emails-directly-from-the-request 10 | --- 11 | Sending emails with user uploaded files in Laravel? 12 | 13 | Did you know you don't have to save the file first — you can simply attach the uploaded file with `attachData` 💌 📸 14 | 15 | Here's a snippet from a Mailable class using it. -------------------------------------------------------------------------------- /content/tips/use-aggregate-methods-to-count-related-models.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use aggregate methods to count related models' 3 | tweet_id: '1464247626405060616' 4 | thread_slug: weekly-thread-2021-47 5 | author_username: alexjgarrett 6 | images: 7 | - 'https://pbs.twimg.com/media/FEy-iNNX0AYjL56.jpg' 8 | created_at: 2021-11-26T15:00:13+00:00 9 | slug: use-aggregate-methods-to-count-related-models 10 | --- 11 | When you're counting related models in @laravelphp, opt for aggregates! 12 | 13 | 👎 Using the count() method on a collection of related models is a tad slower. -------------------------------------------------------------------------------- /content/tips/use-appends-to-include-properties-in-the-array-representation-of-your-model.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use $appends to include properties in the array representation of your model' 3 | tweet_id: '1461703842026770438' 4 | thread_slug: weekly-thread-2021-46 5 | author_username: xiCO2k 6 | images: 7 | - 'https://pbs.twimg.com/media/FEO04rDXsAAQx6i.jpg' 8 | created_at: 2021-11-19T14:32:07+00:00 9 | slug: use-appends-to-include-properties-in-the-array-representation-of-your-model 10 | --- 11 | Had to revisit a #Laravel project from 3 years ago, and found out I did append a mutator in the toArray method 😂, there is no need for that, we can use the "$appends" and it does the same job ✅ -------------------------------------------------------------------------------- /content/tips/use-collections-when-they-can-clean-up-your-code.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use collections when they can clean up your code' 3 | tweet_id: '1272826458667442176' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean8WekXkAEafMW.png' 8 | created_at: 2020-06-16T09:40:50+00:00 9 | slug: use-collections-when-they-can-clean-up-your-code 10 | --- 11 | 12 | Don't turn all arrays into collections just because Laravel offers them, but DO turn arrays into collections when you can make use of collection syntax to clean up your code. -------------------------------------------------------------------------------- /content/tips/use-comments-for-explaining-complex-logic.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use comments for explaining complex logic' 3 | tweet_id: '1495414946556903424' 4 | thread_slug: weekly-thread-2022-07 5 | author_username: brendt_gd 6 | images: 7 | - 'https://pbs.twimg.com/media/FLsw0t6XwAIe5aI.jpg' 8 | created_at: 2022-02-20T15:08:01+00:00 9 | slug: use-comments-for-explaining-complex-logic 10 | --- 11 | 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. -------------------------------------------------------------------------------- /content/tips/use-composer-outdated-direct-to-view-outdated-dependencies-of-your-app.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use `composer outdated --direct` to view outdated dependencies of your app' 3 | tweet_id: '1596508368146817030' 4 | thread_slug: weekly-thread-2022-35 5 | author_username: freekmurze 6 | images: 7 | - 'https://pbs.twimg.com/media/FfXlKEyWAAcxHaQ.jpg' 8 | created_at: 2022-11-26T14:17:11+00:00 9 | slug: use-composer-outdated-direct-to-view-outdated-dependencies-of-your-app 10 | --- 11 | Using `composer outdated —direct` you can view any dependency of your app that has a major / minor / patch release available. 12 | 13 | Here’s the output for the Laravel app that powers https://freek.dev -------------------------------------------------------------------------------- /content/tips/use-composer-why-not-to-see-why-a-dependency-cannot-be-installed.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use `composer why-not` to see why a dependency cannot be installed' 3 | tweet_id: '1479467931159334915' 4 | thread_slug: weekly-thread-2022-01 5 | author_username: freekmurze 6 | images: 7 | - 'https://pbs.twimg.com/media/FHFSeQyXMAk3JFi.jpg' 8 | created_at: 2022-01-07T15:00:16+00:00 9 | slug: use-composer-why-not-to-see-why-a-dependency-cannot-be-installed 10 | --- 11 | 🔥 Composer has a `why-not` command that will tell you why it won’t install a particular version of a package 12 | #php 13 | -------------------------------------------------------------------------------- /content/tips/use-constructor-property-promotion-to-define-class-properties-directly-on-the-constructor.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use constructor property promotion to define class properties directly on the constructor' 3 | tweet_id: '1454133812863152128' 4 | thread_slug: weekly-thread-2021-43 5 | author_username: enunomaduro 6 | images: 7 | - 'https://pbs.twimg.com/media/FCdTrpMX0AAid3y.jpg' 8 | created_at: 2021-10-29T17:11:32+00:00 9 | slug: use-constructor-property-promotion-to-define-class-properties-directly-on-the-constructor 10 | --- 11 | PHP reminder: you can define your class properties directly on the constructor. ✅ -------------------------------------------------------------------------------- /content/tips/use-custom-collections.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use custom collections' 3 | tweet_id: '1272822470656045057' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean3-8QXYAAmi7V.jpg' 8 | created_at: 2020-06-16T09:24:59+00:00 9 | slug: use-custom-collections 10 | --- 11 | 12 | Creating custom collections can be a great way to achieve more expressive syntax. Consider this example with order totals. -------------------------------------------------------------------------------- /content/tips/use-custom-config-files.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use custom config files' 3 | tweet_id: '1272826435254845441' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean6FxnXkAAXDsl.png' 8 | created_at: 2020-06-16T09:40:44+00:00 9 | slug: use-custom-config-files 10 | --- 11 | 12 | You can store things like "results per page" in config files. Don't add them to the app config file though. Create your own. In my e-commerce project, I use config/shop.php. -------------------------------------------------------------------------------- /content/tips/use-data-transfer-objects-dtos.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use Data Transfer Objects (DTOs)' 3 | tweet_id: '1272822466528845825' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean3uMaWAAApBhb.jpg' 8 | created_at: 2020-06-16T09:24:58+00:00 9 | slug: use-data-transfer-objects-dtos 10 | --- 11 | 12 | Rather than passing a huge amount of arguments in a specific order, consider creating an object with properties to store this data. 13 | 14 | Bonus points if you can find that some behavior can be moved into to this object. -------------------------------------------------------------------------------- /content/tips/use-declarestrict-types1-to-enable-strict-mode-for-type-checking.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use declare(strict_types=1) to enable strict mode for type checking' 3 | tweet_id: '1454133808786202627' 4 | thread_slug: weekly-thread-2021-43 5 | author_username: enunomaduro 6 | images: 7 | - 'https://pbs.twimg.com/media/FCiPA0kWUAUoban.jpg' 8 | created_at: 2021-10-29T17:11:31+00:00 9 | slug: use-declarestrict-types1-to-enable-strict-mode-for-type-checking 10 | --- 11 | PHP reminder: The "declare(strict_types = 1);" directive enables strict mode. In strict mode, only a variable of exact type of the “type declaration” will be accepted, or a "TypeError" will be thrown. ✅ -------------------------------------------------------------------------------- /content/tips/use-docblocks-only-when-they-clarify-things.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use docblocks only when they clarify things' 3 | tweet_id: '1272826454301163520' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean8DcIXkAESZ_P.jpg' 8 | created_at: 2020-06-16T09:40:49+00:00 9 | slug: use-docblocks-only-when-they-clarify-things 10 | --- 11 | 12 | Many people will disagree with this, because they do it. But it makes no sense. 13 | 14 | There's no point in using docblocks when they don't give any extra information. If the typehint is enough, don't add a docblock. 15 | 16 | That's just noise. -------------------------------------------------------------------------------- /content/tips/use-eloquent-scopes-to-clean-up-complex-relation-queries.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use Eloquent scopes to clean up complex relation queries' 3 | tweet_id: '1487081935478276103' 4 | thread_slug: weekly-thread-2022-04 5 | author_username: archtechx 6 | images: 7 | - 'https://pbs.twimg.com/media/FKCIrumVQAcD8RB.jpg' 8 | created_at: 2022-01-28T15:15:36+00:00 9 | slug: use-eloquent-scopes-to-clean-up-complex-relation-queries 10 | --- 11 | 🔥 Eloquent scopes pair very well with complex relation queries 12 | 13 | Scopes should also have @method annotations. They make the model more self-documenting & better supported in IDEs -------------------------------------------------------------------------------- /content/tips/use-events.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use events' 3 | tweet_id: '1272822453753036801' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean07-jXkAErgaL.jpg' 8 | created_at: 2020-06-16T09:24:55+00:00 9 | slug: use-events 10 | --- 11 | 12 | Consider offloading some logic from controllers to events. For example, when creating models. 13 | 14 | The benefit is that creating these models will work the same everywhere (controllers, jobs, ...) and the controller has one less worry about the details of the DB schema -------------------------------------------------------------------------------- /content/tips/use-expressive-names-for-methods.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use expressive names for methods' 3 | tweet_id: '1272822475957645312' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean4xcqWAAUsjdG.png' 8 | created_at: 2020-06-16T09:25:00+00:00 9 | slug: use-expressive-names-for-methods 10 | --- 11 | 12 | Rather than thinking "what can this object do", think about "what can be done with this object". Exceptions apply, such as with action classes, but this is a good rule of thumb. 13 | 14 | https://www.youtube.com/watch?v=dfgtKb-VpRk -------------------------------------------------------------------------------- /content/tips/use-fakernumerify-to-create-strings-with-numbers-at-specific-places.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use Faker::numerify() to create strings with numbers at specific places' 3 | tweet_id: '1495414931788746755' 4 | thread_slug: weekly-thread-2022-07 5 | author_username: SteveTheBauman 6 | images: 7 | - 'https://pbs.twimg.com/media/FLkESRpXIAwj769.jpg' 8 | created_at: 2022-02-20T15:07:57+00:00 9 | slug: use-fakernumerify-to-create-strings-with-numbers-at-specific-places 10 | --- 11 | A quick one that I *always* forget about -- Faker::numerify, allowing you to generate numeric data in a specific pattern 👌👏 -------------------------------------------------------------------------------- /content/tips/use-not-to-reverse-an-assertion-in-pestphp.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use ->not to reverse an assertion in @pestphp ' 3 | tweet_id: '1454133816990240773' 4 | thread_slug: weekly-thread-2021-43 5 | author_username: enunomaduro 6 | images: 7 | - 'https://pbs.twimg.com/media/FCtnhAvXEAco-Kc.jpg' 8 | created_at: 2021-10-29T17:11:33+00:00 9 | slug: use-not-to-reverse-an-assertion-in-pestphp 10 | --- 11 | Pest reminder: if you know how to test something, "not()" lets you test its opposite. ✅ 12 | 13 | https://pestphp.com/docs/expectations#expect-not 14 | -------------------------------------------------------------------------------- /content/tips/use-on-demand-notifications-to-send-messages-to-unregistered-users.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use on-demand notifications to send messages to unregistered users' 3 | tweet_id: '1498010803156381696' 4 | thread_slug: weekly-thread-2022-08 5 | author_username: bhaidar 6 | images: 7 | - 'https://pbs.twimg.com/media/FKDorcxVQAEERjT.jpg' 8 | created_at: 2022-02-27T19:03:01+00:00 9 | slug: use-on-demand-notifications-to-send-messages-to-unregistered-users 10 | --- 11 | 🌶️ #Laravel tip: Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. 12 | 13 | Welcome to On-Demand Notifications in Laravel 🔥 14 | 15 | #PHP #Developers -------------------------------------------------------------------------------- /content/tips/use-partitions-for-deleting-mass-amounts-of-data.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use partitions for deleting mass amounts of data' 3 | tweet_id: '1479467943276670979' 4 | thread_slug: weekly-thread-2022-01 5 | author_username: tobias_petry 6 | images: 7 | - 'https://pbs.twimg.com/media/FIQQcQSXwAk2rDy.jpg' 8 | created_at: 2022-01-07T15:00:19+00:00 9 | slug: use-partitions-for-deleting-mass-amounts-of-data 10 | --- 11 | ⚡ ️Database Tip 12 | 13 | Some applications want to periodically deleted old historic data (or have to because of regulations). Deleting billions of rows is a very slow task which could take several minutes and may take your application down. Use partitions for efficient deleting! 14 | -------------------------------------------------------------------------------- /content/tips/use-retry-for-callbacks-that-may-randomly-fail.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use retry() for callbacks that may randomly fail' 3 | tweet_id: '1471864638199451648' 4 | thread_slug: weekly-thread-2021-50 5 | author_username: alexjgarrett 6 | images: 7 | - 'https://pbs.twimg.com/media/FGP3MSQWQAYKjSm.jpg' 8 | created_at: 2021-12-17T15:27:30+00:00 9 | slug: use-retry-for-callbacks-that-may-randomly-fail 10 | --- 11 | .@laravelphp out here helping me again, with its helpers! 12 | 13 | I was hitting a shaky API that sometimes failed. 14 | 15 | Here, the retry function tries the callback 3 times, with a 2 second interval in-between retries. 16 | -------------------------------------------------------------------------------- /content/tips/use-short-operators.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use short operators' 3 | tweet_id: '1272826443630817281' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean63YeXQAABhBd.jpg' 8 | created_at: 2020-06-16T09:40:46+00:00 9 | slug: use-short-operators 10 | --- 11 | 12 | PHP has many great operators that can replace ugly if checks. Memorize them. -------------------------------------------------------------------------------- /content/tips/use-skip-when-writing-tests-ahead-of-time.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use skip() when writing tests ahead of time' 3 | tweet_id: '1479467933705195521' 4 | thread_slug: weekly-thread-2022-01 5 | author_username: bhaidar 6 | images: 7 | - 'https://pbs.twimg.com/media/FHNHgg4VgAAFSzE.jpg' 8 | created_at: 2022-01-07T15:00:17+00:00 9 | slug: use-skip-when-writing-tests-ahead-of-time 10 | --- 11 | 🌶️ #Laravel #pestphp tip 12 | 13 | If you like to plan your tests ahead of time and implement them one by one, you can always make use of a handy method `skip()` to tell the test runner to ignore those empty tests. 14 | 15 | `skip()` accepts a callback too! 16 | -------------------------------------------------------------------------------- /content/tips/use-strict-comparison.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use strict comparison' 3 | tweet_id: '1272826452652810240' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean722QXgAENwmW.jpg' 8 | created_at: 2020-06-16T09:40:48+00:00 9 | slug: use-strict-comparison 10 | --- 11 | 12 | ALWAYS use strict comparison (=== and !==). If needed, cast things go the correct type before comparing. Better than weird == results 13 | 14 | Also consider enabling strict types in your code. This will prevent passing variables of wrong data types to functions -------------------------------------------------------------------------------- /content/tips/use-tap-to-do-something-with-the-object-and-immediately-return-it.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use tap() to do something with the object and immediately return it' 3 | tweet_id: '1498010800098734081' 4 | thread_slug: weekly-thread-2022-08 5 | author_username: enunomaduro 6 | images: 7 | - 'https://pbs.twimg.com/media/FMMN_6wXsAMmS_e.jpg' 8 | created_at: 2022-02-27T19:03:01+00:00 9 | slug: use-tap-to-do-something-with-the-object-and-immediately-return-it 10 | --- 11 | Use the @laravelphp's "tap()" function to do something with an object, and then return the object itself. 🧋 -------------------------------------------------------------------------------- /content/tips/use-the-aftermaking-or-aftercreating-hooks-in-factories-to-execute-additional-logic.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use the ''afterMaking'' or ''afterCreating'' hooks in factories to execute additional logic' 3 | tweet_id: '1466810192801120259' 4 | thread_slug: weekly-thread-2021-48 5 | author_username: mattkingshott 6 | images: 7 | - 'https://pbs.twimg.com/media/FFXsvEtXsAIrx_I.jpg' 8 | created_at: 2021-12-03T16:42:56+00:00 9 | slug: use-the-aftermaking-or-aftercreating-hooks-in-factories-to-execute-additional-logic 10 | --- 11 | 💡#Laravel Tip: Database model factories have handy 'afterMaking' and 'afterCreating' callback methods that you can use to perform additional tasks on newly-created objects. -------------------------------------------------------------------------------- /content/tips/use-the-policy-helper-to-resolve-a-policy-for-a-model.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use the policy() helper to resolve a policy for a model' 3 | tweet_id: '1494019545446567939' 4 | thread_slug: weekly-thread-2022-06 5 | author_username: asantibanez 6 | images: 7 | - 'https://pbs.twimg.com/media/FLNAs-bXIAExJxr.jpg' 8 | created_at: 2022-02-16T18:43:11+00:00 9 | slug: use-the-policy-helper-to-resolve-a-policy-for-a-model 10 | --- 11 | TIL about @laravelphp policy() helper. Give it a model and it will resolve the policy for you. 12 | 13 | Very useful when testing policies behavior. 💪 14 | -------------------------------------------------------------------------------- /content/tips/use-the-reset-method-to-reset-properties-to-their-original-state-in-livewire.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use the reset() method to reset properties to their original state in Livewire' 3 | tweet_id: '1456649620918992898' 4 | thread_slug: weekly-thread-2021-44 5 | author_username: sky_0xs 6 | images: 7 | - 'https://pbs.twimg.com/media/FC-XoMFXEAAZGXM.jpg' 8 | created_at: 2021-11-05T15:48:27+00:00 9 | slug: use-the-reset-method-to-reset-properties-to-their-original-state-in-livewire 10 | --- 11 | #Laravel Livewire Tip: 12 | If you want to remove property values at once and make your code cleaner, you can use `$this->reset` method. 13 | 14 | Here is an example: -------------------------------------------------------------------------------- /content/tips/use-the-something-at-convention-instead-of-is-something-in-your-table-definitions.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use the something_at convention instead of is_something in your table definitions' 3 | tweet_id: '1461703830240776197' 4 | thread_slug: weekly-thread-2021-46 5 | author_username: alexjgarrett 6 | images: 7 | - 'https://pbs.twimg.com/media/FEAG6YUXEBMceDT.jpg' 8 | created_at: 2021-11-19T14:32:04+00:00 9 | slug: use-the-something-at-convention-instead-of-is-something-in-your-table-definitions 10 | --- 11 | Using the 'something_at' convention instead of just a boolean in Laravel models gives you visibility into when a flag was changed – like when a product went live. -------------------------------------------------------------------------------- /content/tips/use-the-stream-method-to-send-a-file-to-the-browser-without-triggering-a-download.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use the stream() method to send a file to the browser without triggering a download' 3 | tweet_id: '1499806901390827523' 4 | thread_slug: weekly-thread-2022-09 5 | author_username: avosalmon 6 | images: 7 | - 'https://pbs.twimg.com/media/FMwQ4iQaUAIpajf.jpg' 8 | created_at: 2022-03-04T18:00:05+00:00 9 | slug: use-the-stream-method-to-send-a-file-to-the-browser-without-triggering-a-download 10 | --- 11 | #Laravel Tip 🔥 If you want to return a file content without initiating a download, you can use the stream() method. It will display the file in the browser. -------------------------------------------------------------------------------- /content/tips/use-to-use-alpine-property-binding-inside-blade-templates.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use `::` to use Alpine property binding inside Blade templates' 3 | tweet_id: '1499806910886789121' 4 | thread_slug: weekly-thread-2022-09 5 | author_username: itsmarkmead 6 | images: 7 | - 'https://pbs.twimg.com/media/FM8JgUHXIAgj5Vl.jpg' 8 | created_at: 2022-03-04T18:00:07+00:00 9 | slug: use-to-use-alpine-property-binding-inside-blade-templates 10 | --- 11 | TIL: You can pass Alpine JS data to Blade components by using `::` ✨ 12 | 13 | #laravel -------------------------------------------------------------------------------- /content/tips/use-wherebelongsto-and-relation-is-instead-of-comparing-ids-manually.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use whereBelongsTo() and relation()->is() instead of comparing ids manually' 3 | tweet_id: '1466810182265032710' 4 | thread_slug: weekly-thread-2021-48 5 | author_username: archtechx 6 | images: 7 | - 'https://pbs.twimg.com/media/FFXqNWlVUAElTew.jpg' 8 | created_at: 2021-12-03T16:42:54+00:00 9 | slug: use-wherebelongsto-and-relation-is-instead-of-comparing-ids-manually 10 | --- 11 | 🔥 Tip: You don't have to use "related_id"-type columns in database queries or value comparisons. 12 | 13 | Laravel understands your relations and lets you write much cleaner code. 14 | -------------------------------------------------------------------------------- /content/tips/use-wire-entangle-instead-of-entangle.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Quick tip: Use $wire.entangle() instead of @entangle' 3 | tweet_id: '' 4 | thread_slug: obscure-livewire-tips 5 | author_username: samuelstancl 6 | images: 7 | - 'https://cln.sh/tjz7SC/download' 8 | created_at: 2021-04-09T17:25:56+02:00 9 | slug: use-wire-entangle-instead-of-entangle 10 | --- 11 | 12 | It's good to get into the habit of using $wire, since it provides a full communication layer for your Livewire component. 13 | 14 | It also doesn't run into issues when you use it inside single quoted attributes. 15 | -------------------------------------------------------------------------------- /content/tips/use-wire-replace.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use wire:replace' 3 | tweet_id: '1380542122105921536' 4 | thread_slug: obscure-livewire-tips 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EyirvPAWQAIN6ib.jpg' 8 | created_at: 2021-04-09T16:11:56+02:00 9 | slug: use-wire-replace 10 | --- 11 | 12 | As you know, Livewire sometimes runs into painful DOM diffing issues. They can usually be solved with simple workarounds, but sometimes those workarounds get quite complex. 13 | 14 | So I built a package that adds a `wire:replace` directive, telling Livewire to replace an entire chunk of the DOM, instead of trying to diff individual changes. 15 | -------------------------------------------------------------------------------- /content/tips/use-wireentangle-instead-of-entangle.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Use `$wire.entangle()` instead of `$entangle` ' 3 | tweet_id: '1550466505782874113' 4 | thread_slug: weekly-thread-2022-29 5 | author_username: JuanDMeGon 6 | images: 7 | - 'https://pbs.twimg.com/media/FXu2k3xVEAMUFKg.jpg' 8 | created_at: 2022-07-22T13:03:15+00:00 9 | slug: use-wireentangle-instead-of-entangle 10 | --- 11 | TIL: 12 | 13 | In Laravel Livewire, it's better sometimes to use wire.entangle(), instead of the entangle directive, avoids weird issues like "invalid or unexpected token." 14 | 15 | Thanks, @samuelstancl, for posting that gem. 🔥 -------------------------------------------------------------------------------- /content/tips/when-creating-jobs-only-accept-the-needed-data.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'When creating jobs, only accept the needed data' 3 | tweet_id: '1530215258135990272' 4 | thread_slug: weekly-thread-2022-21 5 | author_username: morrislaptop 6 | images: 7 | - 'https://pbs.twimg.com/media/FTihMVRXoAIt4AF.jpg' 8 | - 'https://pbs.twimg.com/media/FTihNyPWIAAAsbE.jpg' 9 | created_at: 2022-05-27T15:52:02+00:00 10 | slug: when-creating-jobs-only-accept-the-needed-data 11 | --- 12 | When creating Laravel Jobs, only accept the data you need to handle the job instead of large wrapper objects / models -------------------------------------------------------------------------------- /content/tips/write-functional-code-when-it-benefits-you.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Write functional code when it benefits you' 3 | tweet_id: '1272826462031286272' 4 | thread_slug: laravel-clean-code-tactics 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Ean8cQUWoAEjdO3.jpg' 8 | created_at: 2020-06-16T09:40:51+00:00 9 | slug: write-functional-code-when-it-benefits-you 10 | --- 11 | 12 | Functional code can both clean things up and make them impossible to understand. Refactor common loops into functional calls, but don't write stupidly complex reduce()s just to avoid writing a loop. There's a use case for both. -------------------------------------------------------------------------------- /content/tips/you-can-add-a-tags-method-to-a-job-anything-you-return-from-this-method-will-be-displayed-in-horizon.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can add a tags() method to a job. Anything you return from this method will be displayed in Horizon' 3 | tweet_id: '1308134110595084288' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidtAYaXkAEjAl-.jpg' 8 | created_at: 2020-09-21T20:00:50+00:00 9 | slug: you-can-add-a-tags-method-to-a-job-anything-you-return-from-this-method-will-be-displayed-in-horizon 10 | --- 11 | 12 | Very useful if you want to tag jobs with things like the user/tenant id. -------------------------------------------------------------------------------- /content/tips/you-can-add-a-uri-fragment-when-redirecting-to-a-route.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can add a URI fragment when redirecting to a route' 3 | tweet_id: '1538579123949346816' 4 | thread_slug: weekly-thread-2022-24 5 | author_username: ecrmnn 6 | images: 7 | - 'https://pbs.twimg.com/media/FVYsVf5VsAEan8N.jpg' 8 | created_at: 2022-06-19T17:47:03+00:00 9 | slug: you-can-add-a-uri-fragment-when-redirecting-to-a-route 10 | --- 11 | You can add a URI fragment when redirecting to a route in Laravel. 12 | 13 | This is super useful when redirecting to a specific section of the page. E.g. reviews section on a product page 📈 -------------------------------------------------------------------------------- /content/tips/you-can-add-temporaryurl-to-any-storage-driver.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can add `temporaryUrl()` to any storage driver' 3 | tweet_id: '1517561135108485120' 4 | thread_slug: weekly-thread-2022-16 5 | author_username: abrardev99 6 | images: 7 | - 'https://pbs.twimg.com/media/FQ2yBLeXEAAwNPY.jpg' 8 | created_at: 2022-04-22T17:49:04+00:00 9 | slug: you-can-add-temporaryurl-to-any-storage-driver 10 | --- 11 | Laravel tip💡You can add a Temporary URL for the local storage driver 12 | #laravel -------------------------------------------------------------------------------- /content/tips/you-can-add-this-tailwind-plugin-to-generate-child-selector-variants.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can add this Tailwind plugin to generate child-selector variants' 3 | tweet_id: '1489620177071210497' 4 | thread_slug: weekly-thread-2022-05 5 | author_username: warsh33p 6 | images: 7 | - 'https://pbs.twimg.com/media/FKaHaf9XsAQzC_0.jpg' 8 | created_at: 2022-02-04T15:21:40+00:00 9 | slug: you-can-add-this-tailwind-plugin-to-generate-child-selector-variants 10 | --- 11 | 🔥 Since I’m having to deal with a lot of generated markup recently, this small child-selector plugin for Tailwind has been a life saver. 12 | -------------------------------------------------------------------------------- /content/tips/you-can-assert-that-a-job-will-be-deleted-from-the-queue.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can assert that a job will be deleted from the queue ' 3 | tweet_id: '1550466511432650753' 4 | thread_slug: weekly-thread-2022-29 5 | author_username: nuernberger_me 6 | images: 7 | - 'https://pbs.twimg.com/media/FYA56XjXwAQSuf8.jpg' 8 | created_at: 2022-07-22T13:03:17+00:00 9 | slug: you-can-assert-that-a-job-will-be-deleted-from-the-queue 10 | --- 11 | 🔥 #Laravel testing tip 12 | 13 | Asserting that a job will be deleted from the queue -------------------------------------------------------------------------------- /content/tips/you-can-associate-an-input-with-a-form-using-the-form-attribute.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can associate an input with a form using the form= attribute' 3 | tweet_id: '1512463810069598212' 4 | thread_slug: weekly-thread-2022-14 5 | author_username: joemasilotti 6 | images: 7 | - 'https://pbs.twimg.com/media/FPh2K65VQAQO5xz.jpg' 8 | created_at: 2022-04-08T16:14:07+00:00 9 | slug: you-can-associate-an-input-with-a-form-using-the-form-attribute 10 | --- 11 | Wait... what?! 🤯 12 | 13 | https://www.smashingmagazine.com/2022/03/html-attributes-you-never-use/#the-form-attribute-for-form-fields -------------------------------------------------------------------------------- /content/tips/you-can-calculate-the-age-of-carbon-instances.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can calculate the `age()` of Carbon instances' 3 | tweet_id: '1512463795364384771' 4 | thread_slug: weekly-thread-2022-14 5 | author_username: victoryoalli 6 | images: 7 | - 'https://pbs.twimg.com/media/FPh7dVyWUAEW5EQ.jpg' 8 | created_at: 2022-04-08T16:14:03+00:00 9 | slug: you-can-calculate-the-age-of-carbon-instances 10 | --- 11 | #TIL How to calculate the age using a date in Laravel or using Carbon. 12 | 13 | #LaravelTip #PHPTip #dev -------------------------------------------------------------------------------- /content/tips/you-can-chain-can-to-route-definitions-to-specify-policy-rules.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can chain ->can() to Route definitions to specify policy rules' 3 | tweet_id: '1459206740340187141' 4 | thread_slug: weekly-thread-2021-45 5 | author_username: sky_0xs 6 | images: 7 | - 'https://pbs.twimg.com/media/FDx9zXTXIAkeX_-.jpg' 8 | created_at: 2021-11-12T17:09:32+00:00 9 | slug: you-can-chain-can-to-route-definitions-to-specify-policy-rules 10 | --- 11 | #Laravel Tip: 12 | If you are running Laravel `v8.70`, you can chain `can()` method directly instead of `middleware('can:..')` 13 | 14 | Here is and example: 15 | -------------------------------------------------------------------------------- /content/tips/you-can-clear-all-laravel-caches-using-optimizeclear.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can clear all Laravel caches using `optimize:clear`' 3 | tweet_id: '1507455552892268546' 4 | thread_slug: weekly-thread-2022-12 5 | author_username: aschmelyun 6 | images: 7 | - 'https://pbs.twimg.com/media/FOeOo81WYAUa42D.jpg' 8 | created_at: 2022-03-25T20:33:05+00:00 9 | slug: you-can-clear-all-laravel-caches-using-optimizeclear 10 | --- 11 | Just found out there's a single artisan command to clear out all Laravel caches, much less typing! -------------------------------------------------------------------------------- /content/tips/you-can-conditionally-skip-scheduled-jobs.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can conditionally skip() scheduled jobs' 3 | tweet_id: '1495414940684804100' 4 | thread_slug: weekly-thread-2022-07 5 | author_username: cosmeescobedo 6 | images: 7 | - 'https://pbs.twimg.com/media/FL2KtKzVgAABGiG.jpg' 8 | created_at: 2022-02-20T15:07:59+00:00 9 | slug: you-can-conditionally-skip-scheduled-jobs 10 | --- 11 | 🔥 #Laravel the skip method in scheduler -------------------------------------------------------------------------------- /content/tips/you-can-create-dynamic-relationships-this-relationship-is-based-on-a-column-thats-added-using-a-subquery-in-a-scope.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can create dynamic relationships — this relationship is based on a column that''s added using a subquery, in a scope' 3 | tweet_id: '1308134107118022666' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidrdqwWkAIy4oN.png' 8 | created_at: 2020-09-21T20:00:49+00:00 9 | slug: you-can-create-dynamic-relationships-this-relationship-is-based-on-a-column-thats-added-using-a-subquery-in-a-scope 10 | --- 11 | 12 | And so much more. -------------------------------------------------------------------------------- /content/tips/you-can-create-storage-disks-on-the-fly.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can create Storage disks on the fly' 3 | tweet_id: '1512463804205973508' 4 | thread_slug: weekly-thread-2022-14 5 | author_username: ryangjchandler 6 | images: 7 | - 'https://pbs.twimg.com/media/FPwqSygWYAAbSUh.jpg' 8 | created_at: 2022-04-08T16:14:05+00:00 9 | slug: you-can-create-storage-disks-on-the-fly 10 | --- 11 | 🔥 Did you know that you can create Storage disks on the fly in @laravelphp? This is super useful when you want your user to provide their own filesystem credentials, e.g. a user can bring their own S3 bucket to your app. -------------------------------------------------------------------------------- /content/tips/you-can-create-text-based-tables-in-laravel-even-outside-cli-commands.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can create text-based tables in Laravel even outside CLI commands' 3 | tweet_id: '1456649616934404097' 4 | thread_slug: weekly-thread-2021-44 5 | author_username: SteveTheBauman 6 | images: 7 | - 'https://pbs.twimg.com/media/FDR9jFzXsAICBd9.jpg' 8 | created_at: 2021-11-05T15:48:26+00:00 9 | slug: you-can-create-text-based-tables-in-laravel-even-outside-cli-commands 10 | --- 11 | If you ever need to generate text-based tables for sending in text messages, outputting in console, or in logs, @symfony provides an awesome "Table" class, just for that! 💅 Such a cool utility! 🤩 -------------------------------------------------------------------------------- /content/tips/you-can-debounce-a-function-using-alpinedebounce.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can debounce a function using Alpine.debounce()' 3 | tweet_id: '1507455555899564032' 4 | thread_slug: weekly-thread-2022-12 5 | author_username: zepfietje 6 | images: { } 7 | created_at: 2022-03-25T20:33:06+00:00 8 | slug: you-can-debounce-a-function-using-alpinedebounce 9 | --- 10 | ❓ Using Alpine.js and need to debounce a function? 11 | 12 | ❌ You don't need JavaScript libraries like lodash. 13 | 14 | ✅ Just use Alpine.debounce() which is also used internally for the x-on:input.debounce="" modifier. 15 | 16 | Cc: @calebporzio -------------------------------------------------------------------------------- /content/tips/you-can-define-casts-for-specific-eloquent-queries.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can define casts for specific Eloquent queries' 3 | tweet_id: '1505269894434021376' 4 | thread_slug: weekly-thread-2022-11 5 | author_username: cosmeescobedo 6 | images: 7 | - 'https://pbs.twimg.com/media/FNwBsytVkAAovTB.jpg' 8 | created_at: 2022-03-19T19:48:04+00:00 9 | slug: you-can-define-casts-for-specific-eloquent-queries 10 | --- 11 | 🔥 #Laravel Query Time Casting 12 | 13 | We all know you can add casts to your eloquent models, but did you know you can add casts to a specific query? -------------------------------------------------------------------------------- /content/tips/you-can-define-default-model-data-for-belongsto-relationships.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can define default model data for BelongsTo relationships' 3 | tweet_id: '1520040284783972352' 4 | thread_slug: weekly-thread-2022-17 5 | author_username: cosmeescobedo 6 | images: 7 | - 'https://pbs.twimg.com/media/FQ6XRnBVgAAHT1w.jpg' 8 | created_at: 2022-04-29T14:00:19+00:00 9 | slug: you-can-define-default-model-data-for-belongsto-relationships 10 | --- 11 | 🔥 Laravel Tip: Default Models. 12 | 13 | In your relationships, you can define default models. 14 | 15 | That way if the relationship doesn't exist it will return a default model so you don't have to check if is null every time. -------------------------------------------------------------------------------- /content/tips/you-can-disable-lazy-loading-using-modelpreventlazyloading.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can disable lazy loading using Model::preventLazyLoading()' 3 | tweet_id: '1489620165201330177' 4 | thread_slug: weekly-thread-2022-05 5 | author_username: mattkingshott 6 | images: 7 | - 'https://pbs.twimg.com/media/FKlnRQ_XwAUqAxB.jpg' 8 | created_at: 2022-02-04T15:21:37+00:00 9 | slug: you-can-disable-lazy-loading-using-modelpreventlazyloading 10 | --- 11 | 🔥 #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. 12 | -------------------------------------------------------------------------------- /content/tips/you-can-dynamically-create-and-extend-interfaces-in-php.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can dynamically create and extend interfaces in PHP' 3 | tweet_id: '1520040287719944192' 4 | thread_slug: weekly-thread-2022-17 5 | author_username: freekmurze 6 | images: 7 | - 'https://pbs.twimg.com/media/FRLy5UXWYAIRIet.jpg' 8 | created_at: 2022-04-29T14:00:20+00:00 9 | slug: you-can-dynamically-create-and-extend-interfaces-in-php 10 | --- 11 | 🔥 Did you know you can dynamically create and/or extend interfaces in #PHP? 12 | 13 | Example from the @pestphp codebase: https://github.com/pestphp/pest/blob/1.x/src/Contracts/HasPrintableTestCaseName.php -------------------------------------------------------------------------------- /content/tips/you-can-eager-load-nested-relations-using-clean-array-syntax.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can eager load nested relations using clean array syntax' 3 | tweet_id: '1542863727476690944' 4 | thread_slug: weekly-thread-2022-26 5 | author_username: ecrmnn 6 | images: 7 | - 'https://pbs.twimg.com/media/FWRcqFbUsAE7MW7.jpg' 8 | created_at: 2022-07-01T13:32:32+00:00 9 | slug: you-can-eager-load-nested-relations-using-clean-array-syntax 10 | --- 11 | Yay! In Laravel 9.18 you can finally eager load ("with") using a nested array. -------------------------------------------------------------------------------- /content/tips/you-can-echo-backed-enums-in-blade.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can echo backed enums in Blade' 3 | tweet_id: '1596508357317185536' 4 | thread_slug: weekly-thread-2022-35 5 | author_username: enunomaduro 6 | images: 7 | - 'https://pbs.twimg.com/media/FeQJefMXEAEnOON.jpg' 8 | created_at: 2022-11-26T14:17:08+00:00 9 | slug: you-can-echo-backed-enums-in-blade 10 | --- 11 | Papercut: starting today's @laravelphp release, Blade can now infer values from PHP 8.1 backed enums. 💅🏻 -------------------------------------------------------------------------------- /content/tips/you-can-enable-js-sourcemaps-using-at-vite-js-in-laravel.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can enable JS sourcemaps using @vite_js in Laravel ' 3 | tweet_id: '1553002662517678081' 4 | thread_slug: weekly-thread-2022-30 5 | author_username: jbrooksuk 6 | images: 7 | - 'https://pbs.twimg.com/media/FYhWV8mWAAULTRT.jpg' 8 | created_at: 2022-07-29T13:01:02+00:00 9 | slug: you-can-enable-js-sourcemaps-using-at-vite-js-in-laravel 10 | --- 11 | 🗺 Using @vite_js? You can enable JS sourcemaps in the vite.config.js file. -------------------------------------------------------------------------------- /content/tips/you-can-freeze-time-in-tests.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can freeze time in tests' 3 | tweet_id: '1509994017227886594' 4 | thread_slug: weekly-thread-2022-13 5 | author_username: AshAllenDesign 6 | images: 7 | - 'https://pbs.twimg.com/media/FO8k5kAWYAAip2V.jpg' 8 | created_at: 2022-04-01T20:40:02+00:00 9 | slug: you-can-freeze-time-in-tests 10 | --- 11 | ❄️In your Laravel tests, you might sometimes need to freeze the time. 12 | 13 | This is particularly useful if you're trying to make assertions based on timestamps or need to make queries based on dates and/or times. 14 | 15 | #laravel #php -------------------------------------------------------------------------------- /content/tips/you-can-generate-fake-images-using-faker.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can generate fake images using Faker' 3 | tweet_id: '1515057392890769410' 4 | thread_slug: weekly-thread-2022-15 5 | author_username: justsanjit 6 | images: 7 | - 'https://pbs.twimg.com/media/FQOhGy6XEAMYB-X.jpg' 8 | created_at: 2022-04-15T20:00:05+00:00 9 | slug: you-can-generate-fake-images-using-faker 10 | --- 11 | #Laravel #PHP Tip 🔥 You can use #faker to not only generate text values but also fake images. -------------------------------------------------------------------------------- /content/tips/you-can-get-all-primary-keys-from-an-eloquent-collection-using-the-modelkeys-method.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can get all primary keys from an Eloquent Collection using the modelKeys() method' 3 | tweet_id: '1517561129215483907' 4 | thread_slug: weekly-thread-2022-16 5 | author_username: SteveTheBauman 6 | images: 7 | - 'https://pbs.twimg.com/media/FQZb4jlWUA0WBWz.jpg' 8 | created_at: 2022-04-22T17:49:02+00:00 9 | slug: you-can-get-all-primary-keys-from-an-eloquent-collection-using-the-modelkeys-method 10 | --- 11 | Always forget about the modelKeys method on Eloquent Collections for getting the ID's from a collection of models 👌 -------------------------------------------------------------------------------- /content/tips/you-can-import-entire-namespaces-in-php.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can import entire namespaces in PHP' 3 | tweet_id: '1538579126595899393' 4 | thread_slug: weekly-thread-2022-24 5 | author_username: archtechx 6 | images: 7 | - 'https://pbs.twimg.com/media/FVYDILtUAAAmQlc.jpg' 8 | created_at: 2022-06-19T17:47:03+00:00 9 | slug: you-can-import-entire-namespaces-in-php 10 | --- 11 | 🔥 You can import entire namespaces in PHP 12 | 13 | This is useful when you're interacting with *many* classes from a single namespace -------------------------------------------------------------------------------- /content/tips/you-can-make-concurrent-requests-using-the-http-clients-pool-method.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can make concurrent requests using the Http client''s `pool() method' 3 | tweet_id: '1520040293952675840' 4 | thread_slug: weekly-thread-2022-17 5 | author_username: cosmeescobedo 6 | images: 7 | - 'https://pbs.twimg.com/media/FQ6aAz0VgAARieH.jpg' 8 | created_at: 2022-04-29T14:00:21+00:00 9 | slug: you-can-make-concurrent-requests-using-the-http-clients-pool-method 10 | --- 11 | 🔥 Laravel Tip: Concurrent Requests. 12 | 13 | Using the HTTP client you can make concurrent requests using the pool method. -------------------------------------------------------------------------------- /content/tips/you-can-make-php-throw-an-exception-when-decoding-json-if-the-value-isnt-valid-json.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can make PHP throw an exception when decoding JSON if the value isn''t valid JSON' 3 | tweet_id: '1454133803056775178' 4 | thread_slug: weekly-thread-2021-43 5 | author_username: SteveTheBauman 6 | images: 7 | - 'https://pbs.twimg.com/media/FCuqk2zWQAsk08o.jpg' 8 | created_at: 2021-10-29T17:11:29+00:00 9 | slug: you-can-make-php-throw-an-exception-when-decoding-json-if-the-value-isnt-valid-json 10 | --- 11 | Had no idea you could have PHP throw a built-in exception when decoding JSON -- I've always done this manually until today 😭 -------------------------------------------------------------------------------- /content/tips/you-can-name-migrations-like-this.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can name migrations "like this"' 3 | tweet_id: '1484566704172634120' 4 | thread_slug: weekly-thread-2022-03 5 | author_username: mvpopuk 6 | images: 7 | - 'https://pbs.twimg.com/media/FJUAG2WXoAU2q_f.jpg' 8 | created_at: 2022-01-21T16:40:58+00:00 9 | slug: you-can-name-migrations-like-this 10 | --- 11 | 🔥 Epic Laravel Tip - Did you know that you don't necessarily have to use underscores for migrations names? -------------------------------------------------------------------------------- /content/tips/you-can-namespace-your-helper-functions.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can namespace your helper functions' 3 | tweet_id: '1538579132019187712' 4 | thread_slug: weekly-thread-2022-24 5 | author_username: archtechx 6 | images: 7 | - 'https://pbs.twimg.com/media/FUzJCu8UcAAdBfT.jpg' 8 | created_at: 2022-06-19T17:47:05+00:00 9 | slug: you-can-namespace-your-helper-functions 10 | --- 11 | 🔥 Namespaced functions are a good way to make use of helper functions, while avoiding conflicts in the global namespace -------------------------------------------------------------------------------- /content/tips/you-can-now-call-newline-on-stringable-instances.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can now call `newLine()` on Stringable instances' 3 | tweet_id: '1509994032033804290' 4 | thread_slug: weekly-thread-2022-13 5 | author_username: djgeisi 6 | images: 7 | - 'https://pbs.twimg.com/media/FPCdrxkWUAASAm5.jpg' 8 | created_at: 2022-04-01T20:40:06+00:00 9 | slug: you-can-now-call-newline-on-stringable-instances 10 | --- 11 | #PHP #Laravel 12 | Since todays Laravel 9.6 release a new newline() method was added to the Stringable Class. 13 | 14 | Thanks to @paulandroshchuk who contributed this -------------------------------------------------------------------------------- /content/tips/you-can-pass-a-custom-view-to-the-artisan-down-command.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can pass a custom view to the artisan down command' 3 | tweet_id: '1530215260837142529' 4 | thread_slug: weekly-thread-2022-21 5 | author_username: JustinBTechGuy 6 | images: 7 | - 'https://pbs.twimg.com/media/FTROCoIWQAA54pF.jpg' 8 | created_at: 2022-05-27T15:52:02+00:00 9 | slug: you-can-pass-a-custom-view-to-the-artisan-down-command 10 | --- 11 | TIL that you can use your own blade file for the maintenance mode screen in #Laravel by using the render option -------------------------------------------------------------------------------- /content/tips/you-can-pass-parameters-to-laravel-middleware-classes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can pass parameters to Laravel middleware classes' 3 | tweet_id: '1466810184773160962' 4 | thread_slug: weekly-thread-2021-48 5 | author_username: marcelpociot 6 | images: 7 | - 'https://pbs.twimg.com/media/FFXH9CSXwAEiMm0.jpg' 8 | created_at: 2021-12-03T16:42:54+00:00 9 | slug: you-can-pass-parameters-to-laravel-middleware-classes 10 | --- 11 | 🔥 Remember that you can pass parameters to your custom @laravelphp middleware classes 12 | 13 | This simple middleware allows me to inject onboarding screens in an Inertia app. -------------------------------------------------------------------------------- /content/tips/you-can-pass-variables-to-blade-views-using-the-withfoobar-syntax.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can pass variables to Blade views using the `withFoo($bar)` syntax ' 3 | tweet_id: '1505269888616591363' 4 | thread_slug: weekly-thread-2022-11 5 | author_username: aschmelyun 6 | images: 7 | - 'https://pbs.twimg.com/media/FNweUY-XMAQg4RV.jpg' 8 | created_at: 2022-03-19T19:48:02+00:00 9 | slug: you-can-pass-variables-to-blade-views-using-the-withfoobar-syntax 10 | --- 11 | I had no idea that you could pass data into Laravel responses using with{Variable} magic methods! I kind of like this way a little better... -------------------------------------------------------------------------------- /content/tips/you-can-process-the-output-of-scheduled-tasks-send-an-email-or-write-to-a-file.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can process the output of scheduled tasks: send an email or write to a file' 3 | tweet_id: '1515057398687313920' 4 | thread_slug: weekly-thread-2022-15 5 | author_username: justsanjit 6 | images: 7 | - 'https://pbs.twimg.com/media/FQHMYW4WQAIxF69.jpg' 8 | created_at: 2022-04-15T20:00:06+00:00 9 | slug: you-can-process-the-output-of-scheduled-tasks-send-an-email-or-write-to-a-file 10 | --- 11 | #Laravel Tip 🔥 Few convenient methods to work with the output of scheduled tasks. -------------------------------------------------------------------------------- /content/tips/you-can-provide-closures-into-the-default-value-in-laravels-config-helper.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can provide closures into the $default value in Laravel''s config helper' 3 | tweet_id: '1555543655087099905' 4 | thread_slug: weekly-thread-2022-31 5 | author_username: realstevebauman 6 | images: 7 | - 'https://pbs.twimg.com/media/FY1jGv3XgAQba6L.jpg' 8 | created_at: 2022-08-05T13:18:02+00:00 9 | slug: you-can-provide-closures-into-the-default-value-in-laravels-config-helper 10 | --- 11 | Huh, apparently you can provide closures into the $default value in Laravel's config helper. Neat! Pretty useful if you want to throw an exception if it's missing 👏 -------------------------------------------------------------------------------- /content/tips/you-can-queue-closures.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can queue Closures' 3 | tweet_id: '1509994028997169158' 4 | thread_slug: weekly-thread-2022-13 5 | author_username: alexjgarrett 6 | images: 7 | - 'https://pbs.twimg.com/media/FO7OX-ZX0AEQooG.jpg' 8 | created_at: 2022-04-01T20:40:05+00:00 9 | slug: you-can-queue-closures 10 | --- 11 | I had no idea you could queue closures in @laravelphp until today. -------------------------------------------------------------------------------- /content/tips/you-can-record-all-login-logout-events.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can record all login & logout events' 3 | tweet_id: '1507455544021250049' 4 | thread_slug: weekly-thread-2022-12 5 | author_username: mattkingshott 6 | images: 7 | - 'https://pbs.twimg.com/media/FOoOjf-XIAMPLIW.jpg' 8 | created_at: 2022-03-25T20:33:03+00:00 9 | slug: you-can-record-all-login-logout-events 10 | --- 11 | 🔥 #Laravel Tip: If your app needs to record logins and logouts for security purposes (auditing), then you should definitely make use of the auth events, which allow you to easily listen for them. 12 | -------------------------------------------------------------------------------- /content/tips/you-can-remove-all-falsy-values-from-a-collection-by-calling-filter-without-any-arguments.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can remove all falsy values from a Collection by calling filter() without any arguments' 3 | tweet_id: '1507455538078003203' 4 | thread_slug: weekly-thread-2022-12 5 | author_username: ecrmnn 6 | images: 7 | - 'https://pbs.twimg.com/media/FOYvPYuWQAoA-2P.jpg' 8 | created_at: 2022-03-25T20:33:02+00:00 9 | slug: you-can-remove-all-falsy-values-from-a-collection-by-calling-filter-without-any-arguments 10 | --- 11 | Laravel Collections tip. To remove all falsy values from the collection, simply call filter without any arguments ✨ -------------------------------------------------------------------------------- /content/tips/you-can-return-mailables-as-responses-from-controllers-it-will-show-the-rendered-version-in-the-browser.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can return Mailables as responses from controllers. It will show the rendered version in the browser' 3 | tweet_id: '1308082892162162690' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/Eic6iydX0AgLupY.png' 8 | created_at: 2020-09-21T16:37:19+00:00 9 | slug: you-can-return-mailables-as-responses-from-controllers-it-will-show-the-rendered-version-in-the-browser 10 | --- 11 | 12 | Great for debugging/tweaking the design. -------------------------------------------------------------------------------- /content/tips/you-can-run-your-tests-in-a-random-order.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can run your tests in a random order' 3 | tweet_id: '1596508351872917504' 4 | thread_slug: weekly-thread-2022-35 5 | author_username: DanSysAnalyst 6 | images: 7 | - 'https://pbs.twimg.com/media/FbeprM_XoAEDnVJ.jpg' 8 | created_at: 2022-11-26T14:17:07+00:00 9 | slug: you-can-run-your-tests-in-a-random-order 10 | --- 11 | 🙂🙃🙂 Have you ever tried running your tests in random order? 12 | 13 | This can be helpful to detect interdependencies between tests. 14 | 15 | (works on @pestphp and PHPUnit) -------------------------------------------------------------------------------- /content/tips/you-can-set-model-attributes-on-factories-using-the-set-method.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can set model attributes on factories using the set() method' 3 | tweet_id: '1517561132222844928' 4 | thread_slug: weekly-thread-2022-16 5 | author_username: justsanjit 6 | images: 7 | - 'https://pbs.twimg.com/media/FQVWw4oXIAAV6Fv.jpg' 8 | created_at: 2022-04-22T17:49:03+00:00 9 | slug: you-can-set-model-attributes-on-factories-using-the-set-method 10 | --- 11 | #Laravel 9.8.0 adds a set() model factory method that allows you to set a single model attribute. -------------------------------------------------------------------------------- /content/tips/you-can-skip-transformrequests-type-middleware.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can skip() TransformRequests-type middleware' 3 | tweet_id: '1494019554304880641' 4 | thread_slug: weekly-thread-2022-06 5 | author_username: pascalbaljet 6 | images: 7 | - 'https://pbs.twimg.com/media/FKwygqPWQAMRaTr.jpg' 8 | created_at: 2022-02-16T18:43:13+00:00 9 | slug: you-can-skip-transformrequests-type-middleware 10 | --- 11 | 💡 As of @laravelphp v8.36.0, you can skip 'TransformRequests' middlewares by registering a callback. 12 | 13 | For example, you can use it on 'TrimStrings' and 'ConvertEmptyStringsToNull'. 14 | 15 | #Laravel #PHP #webdev 16 | -------------------------------------------------------------------------------- /content/tips/you-can-swap-multiple-keywords-in-a-string-using-this-macro.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can swap multiple keywords in a string using this macro' 3 | tweet_id: '1489620174093176833' 4 | thread_slug: weekly-thread-2022-05 5 | author_username: aarondfrancis 6 | images: 7 | - 'https://pbs.twimg.com/media/FKd_FZRXsAEgBjK.jpg' 8 | created_at: 2022-02-04T15:21:39+00:00 9 | slug: you-can-swap-multiple-keywords-in-a-string-using-this-macro 10 | --- 11 | This is one of those macros I carry around from project to project. 12 | 13 | Super clear, super easy, nice little life improvement. 14 | -------------------------------------------------------------------------------- /content/tips/you-can-temporarily-disable-timestamps-when-saving-a-model.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can temporarily disable timestamps when saving a model' 3 | tweet_id: '1512463801278291971' 4 | thread_slug: weekly-thread-2022-14 5 | author_username: BurtDS 6 | images: 7 | - 'https://pbs.twimg.com/media/FPe3PztWQAIaXzC.jpg' 8 | created_at: 2022-04-08T16:14:05+00:00 9 | slug: you-can-temporarily-disable-timestamps-when-saving-a-model 10 | --- 11 | 📝 #Laravel Tip | In some cases you don't want the updated_at field the change when updating small things. .. Did you know you could disable the timestamps while saving your data? 12 | Here is how... 🔥 13 | 14 | #laraveltip #php #code #development #details -------------------------------------------------------------------------------- /content/tips/you-can-time-travel-in-your-tests.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can time travel() in your tests ' 3 | tweet_id: '1547939812220407808' 4 | thread_slug: weekly-thread-2022-28 5 | author_username: ecrmnn 6 | images: 7 | - 'https://pbs.twimg.com/media/FXevKR8UIAAY40z.jpg' 8 | created_at: 2022-07-15T13:43:05+00:00 9 | slug: you-can-time-travel-in-your-tests 10 | --- 11 | 🔮 Travel in time in your Laravel tests. 12 | 13 | Using the *travel()* method you can travel back and forward in time. 14 | 15 | No more Carbon::setTestNow() 16 | 17 | Super useful 👏 -------------------------------------------------------------------------------- /content/tips/you-can-transform-variables-passed-to-translation-strings-right-in-language-files.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can transform variables passed to translation strings right in language files' 3 | tweet_id: '1509994034877534212' 4 | thread_slug: weekly-thread-2022-13 5 | author_username: ecrmnn 6 | images: 7 | - 'https://pbs.twimg.com/media/FPB_HCDXsAUhtvh.jpg' 8 | created_at: 2022-04-01T20:40:06+00:00 9 | slug: you-can-transform-variables-passed-to-translation-strings-right-in-language-files 10 | --- 11 | Did you know that translation variables can easily be capitalized or converterd to lowercase and uppcase in Laravel? 🆙🌍 -------------------------------------------------------------------------------- /content/tips/you-can-unpack-arrays-in-conditions.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can unpack arrays in conditions' 3 | tweet_id: '1527688611008679936' 4 | thread_slug: weekly-thread-2022-20 5 | author_username: SteveTheBauman 6 | images: 7 | - 'https://pbs.twimg.com/media/FSvAVOOWIAIMa5Y.jpg' 8 | created_at: 2022-05-20T16:32:02+00:00 9 | slug: you-can-unpack-arrays-in-conditions 10 | --- 11 | Today I learned you can unpack conditionally in PHP, pretty neat! 👌 -------------------------------------------------------------------------------- /content/tips/you-can-use-array-annotations-to-specify-the-available-keys-and-their-value-types-in-php-arrays.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use array{} annotations to specify the available keys (and their value types) in PHP arrays' 3 | tweet_id: '1466810191521869825' 4 | thread_slug: weekly-thread-2021-48 5 | author_username: freekmurze 6 | images: 7 | - 'https://pbs.twimg.com/media/FFrjS3xXwAIdNuy.jpg' 8 | created_at: 2021-12-03T16:42:56+00:00 9 | slug: you-can-use-array-annotations-to-specify-the-available-keys-and-their-value-types-in-php-arrays 10 | --- 11 | 🔥When you add an `array{}` return docblock, IDEs are able to autocomplete the keys when reaching into that array. 12 | 13 | Sweet! 14 | #php -------------------------------------------------------------------------------- /content/tips/you-can-use-backticks-to-execute-a-shell-command-in-php.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use backticks (``) to execute a shell command in PHP' 3 | tweet_id: '1596508354536304640' 4 | thread_slug: weekly-thread-2022-35 5 | author_username: freekmurze 6 | images: 7 | - 'https://pbs.twimg.com/media/FbbpXeyWIAAR40j.jpg' 8 | created_at: 2022-11-26T14:17:08+00:00 9 | slug: you-can-use-backticks-to-execute-a-shell-command-in-php 10 | --- 11 | 🐘 Can you believe I didn’t know that PHP has a backtick operator? 12 | 13 | Anything between `` will be executed like shell_exec and returned 🤯 14 | 15 | Docs: https://www.php.net/manual/en/language.operators.execution.php -------------------------------------------------------------------------------- /content/tips/you-can-use-docblocks-in-blade-files-to-add-ide-support.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use docblocks in Blade files to add IDE support' 3 | tweet_id: '1505269903317635073' 4 | thread_slug: weekly-thread-2022-11 5 | author_username: freekmurze 6 | images: 7 | - 'https://pbs.twimg.com/media/FN9sAF-XIAA26u3.jpg' 8 | created_at: 2022-03-19T19:48:06+00:00 9 | slug: you-can-use-docblocks-in-blade-files-to-add-ide-support 10 | --- 11 | 🔥 Want to have some autocompletion in Blade? 12 | 13 | You can just add a doc block 👍 14 | 15 | #laravel #php -------------------------------------------------------------------------------- /content/tips/you-can-use-eloquent-wherecolumn-to-compare-columns-to-each-other.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use Eloquent `whereColumn()` to compare columns to each other' 3 | tweet_id: '1538579121193701377' 4 | thread_slug: weekly-thread-2022-24 5 | author_username: LupinityLabs 6 | images: 7 | - 'https://pbs.twimg.com/media/FUw13BSXEAI1_xQ.jpg' 8 | created_at: 2022-06-19T17:47:02+00:00 9 | slug: you-can-use-eloquent-wherecolumn-to-compare-columns-to-each-other 10 | --- 11 | 💡🟰 Quick #Laravel Eloquent tip for comparing database columns to each other within a query. 12 | 13 | You don't have to use any raw statements to do this - whereColumn() has got you covered! 😊 -------------------------------------------------------------------------------- /content/tips/you-can-use-eloquents-exists-method-to-check-whether-a-record-exists.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use Eloquent''s `exists()` method to check whether a record exists' 3 | tweet_id: '1520040290911879168' 4 | thread_slug: weekly-thread-2022-17 5 | author_username: ecrmnn 6 | images: 7 | - 'https://pbs.twimg.com/media/FRXTNRNWUAA7JtE.jpg' 8 | created_at: 2022-04-29T14:00:20+00:00 9 | slug: you-can-use-eloquents-exists-method-to-check-whether-a-record-exists 10 | --- 11 | This is old, but still a great feature. Eloquent is so smooth! Check if a record exists in Laravel with exists() and doesNotExists() -------------------------------------------------------------------------------- /content/tips/you-can-use-giveconfig-when-using-contextual-binding.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use giveConfig() when using contextual binding' 3 | tweet_id: '1466810190271946757' 4 | thread_slug: weekly-thread-2021-48 5 | author_username: sebdedeyne 6 | images: 7 | - 'https://pbs.twimg.com/media/FFdDMbgUcA4YjoD.jpg' 8 | created_at: 2021-12-03T16:42:56+00:00 9 | slug: you-can-use-giveconfig-when-using-contextual-binding 10 | --- 11 | Most of the times I've used contextual binding in Laravel, it's been to share config values. 12 | 13 | TIL there's a more succinct giveConfig method for that -------------------------------------------------------------------------------- /content/tips/you-can-use-onerror-on-the-image-tag.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use `onerror` on the image tag' 3 | tweet_id: '1479467940726468609' 4 | thread_slug: weekly-thread-2022-01 5 | author_username: JuanDMeGon 6 | images: 7 | - 'https://pbs.twimg.com/media/FIWjvXSWUAYjM-j.jpg' 8 | created_at: 2022-01-07T15:00:18+00:00 9 | slug: you-can-use-onerror-on-the-image-tag 10 | --- 11 | 😲 TIL: 12 | You can hide an image when it is broken so you don't get that ugly broken image icon from the browser. 13 | -------------------------------------------------------------------------------- /content/tips/you-can-use-partial-queue-fakes.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use partial Queue fakes' 3 | tweet_id: '1505269909160280065' 4 | thread_slug: weekly-thread-2022-11 5 | author_username: djgeisi 6 | images: 7 | - 'https://pbs.twimg.com/media/FN6W5X6XEAAGlnB.jpg' 8 | created_at: 2022-03-19T19:48:07+00:00 9 | slug: you-can-use-partial-queue-fakes 10 | --- 11 | #Laravel Tip: 12 | Since todays Laravel 9.5 release you can now do partially queue faking. -------------------------------------------------------------------------------- /content/tips/you-can-use-ternary-operators-like-to-use-dump-or-dd-in-your-short-closures.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use ternary operators like ?: to use dump() or dd() in your short closures' 3 | tweet_id: '1456649618205261824' 4 | thread_slug: weekly-thread-2021-44 5 | author_username: jessarchercodes 6 | images: 7 | - 'https://pbs.twimg.com/media/FDOw-QKUUAEbXLw.jpg' 8 | created_at: 2021-11-05T15:48:26+00:00 9 | slug: you-can-use-ternary-operators-like-to-use-dump-or-dd-in-your-short-closures 10 | --- 11 | Do you hate re-writing short closures just to add temporary debugging code? -------------------------------------------------------------------------------- /content/tips/you-can-use-the-at-checked-blade-directive-to-generate-checked-markup.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use the @checked Blade directive to generate checked="" markup' 3 | tweet_id: '1494019560223096837' 4 | thread_slug: weekly-thread-2022-06 5 | author_username: AshAllenDesign 6 | images: 7 | - 'https://pbs.twimg.com/media/FKwA95pWUAInwgf.jpg' 8 | created_at: 2022-02-16T18:43:15+00:00 9 | slug: you-can-use-the-at-checked-blade-directive-to-generate-checked-markup 10 | --- 11 | 🔥 In Laravel 9, you'll be able to use the cool new "checked" Blade directive. 12 | 13 | This is going to be a nice addition that we can use to clean up our Blade views a little bit 14 | 15 | #laravel #php 16 | -------------------------------------------------------------------------------- /content/tips/you-can-use-the-at-production-blade-directive-to-load-specific-scripts-only-in-production-mode.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use the @production Blade directive to load specific scripts only in production mode' 3 | tweet_id: '1482036552242892803' 4 | thread_slug: weekly-thread-2022-02 5 | author_username: ecrmnn 6 | images: 7 | - 'https://pbs.twimg.com/media/FI_vAnAWQAEddIH.jpg' 8 | created_at: 2022-01-14T17:07:03+00:00 9 | slug: you-can-use-the-at-production-blade-directive-to-load-specific-scripts-only-in-production-mode 10 | --- 11 | 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 -------------------------------------------------------------------------------- /content/tips/you-can-use-the-data-get-method-to-safely-access-a-nested-array-value.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use the data_get() method to safely access a nested array value' 3 | tweet_id: '1461703836553265154' 4 | thread_slug: weekly-thread-2021-46 5 | author_username: mattkingshott 6 | images: 7 | - 'https://pbs.twimg.com/media/FEZJDDbWYAE2fiL.jpg' 8 | created_at: 2021-11-19T14:32:06+00:00 9 | slug: you-can-use-the-data-get-method-to-safely-access-a-nested-array-value 10 | --- 11 | 💡#Laravel Tip: Dealing with deeply-nested arrays can result in missing key / value exceptions. Fortunately, Laravel's data_get() helper makes this easy to avoid. It also supports deeply-nested objects. -------------------------------------------------------------------------------- /content/tips/you-can-use-the-date-helper-on-the-request-class-to-retrieve-a-value-as-a-carbon-instance.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use the date helper on the Request class to retrieve a value as a Carbon instance' 3 | tweet_id: '1487081926103945217' 4 | thread_slug: weekly-thread-2022-04 5 | author_username: mmartin_joo 6 | images: 7 | - 'https://pbs.twimg.com/media/FJ49UFhWYAEWFyu.jpg' 8 | created_at: 2022-01-28T15:15:34+00:00 9 | slug: you-can-use-the-date-helper-on-the-request-class-to-retrieve-a-value-as-a-carbon-instance 10 | --- 11 | 💡There's a really helpful date helper on the Request class. 12 | 13 | You can retrieve a value as a Carbon instance: -------------------------------------------------------------------------------- /content/tips/you-can-use-the-new-strtransliterate-helper-to-convert-a-string-to-its-closest-ascii-representation.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use the new Str::transliterate() helper to convert a string to its closest ASCII representation' 3 | tweet_id: '1489620162357579778' 4 | thread_slug: weekly-thread-2022-05 5 | author_username: freekmurze 6 | images: 7 | - 'https://pbs.twimg.com/media/FKmRs46XsAA85Bh.jpg' 8 | created_at: 2022-02-04T15:21:37+00:00 9 | slug: you-can-use-the-new-strtransliterate-helper-to-convert-a-string-to-its-closest-ascii-representation 10 | --- 11 | Pretty cool string helper method 12 | https://laravel-news.com/laravel-8-82-0 13 | #laravel #php 14 | -------------------------------------------------------------------------------- /content/tips/you-can-use-the-spread-operator-to-merge-arrays-just-like-in-javascript.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use the spread operator to merge arrays, just like in JavaScript' 3 | tweet_id: '1466810186002096137' 4 | thread_slug: weekly-thread-2021-48 5 | author_username: mmartin_joo 6 | images: 7 | - 'https://pbs.twimg.com/media/FFS1obRWQAgZFTB.png' 8 | created_at: 2021-12-03T16:42:55+00:00 9 | slug: you-can-use-the-spread-operator-to-merge-arrays-just-like-in-javascript 10 | --- 11 | A quick reminder about a not-so-often used #PHP feature. 12 | 13 | We have the spread operator, and it works just like the one in JavaScript. -------------------------------------------------------------------------------- /content/tips/you-can-use-the-value-method-in-eloquent-to-fetch-a-single-column-from-the-db.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use the value() method in Eloquent to fetch a single column from the DB' 3 | tweet_id: '1482036550967853057' 4 | thread_slug: weekly-thread-2022-02 5 | author_username: SteveTheBauman 6 | images: 7 | - 'https://pbs.twimg.com/media/FJEgq7SXwAE5rpl.jpg' 8 | created_at: 2022-01-14T17:07:03+00:00 9 | slug: you-can-use-the-value-method-in-eloquent-to-fetch-a-single-column-from-the-db 10 | --- 11 | Just learned about the Eloquent "value()" method from @amaelftah 💪. Eloquent make things so easy. Seems like there's shortcuts hiding everywhere, I love it! 💅🤩 -------------------------------------------------------------------------------- /content/tips/you-can-use-this-gtmock-in-pest-tests.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use $this->mock in Pest tests' 3 | tweet_id: '1505269906157187072' 4 | thread_slug: weekly-thread-2022-11 5 | author_username: enunomaduro 6 | images: 7 | - 'https://pbs.twimg.com/media/FN-0CQaWUAYsMxv.jpg' 8 | created_at: 2022-03-19T19:48:06+00:00 9 | slug: you-can-use-this-gtmock-in-pest-tests 10 | --- 11 | Within your Pest / PHPUnit tests, you may use @laravelphp's "mock" method to instruct the container to use your mocked instance of the object instead of constructing the object itself. ✅ -------------------------------------------------------------------------------- /content/tips/you-can-use-to-route-instead-of-redirect-gtroute.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use `to_route` instead of `redirect()->route()`' 3 | tweet_id: '1532800039315066880' 4 | thread_slug: weekly-thread-2022-22 5 | author_username: enunomaduro 6 | images: 7 | - 'https://pbs.twimg.com/media/FT811QpXoAMUMG_.jpg' 8 | created_at: 2022-06-03T19:03:02+00:00 9 | slug: you-can-use-to-route-instead-of-redirect-gtroute 10 | --- 11 | Here is @laravelphp tip that makes your code more expressive. 💅 12 | 13 | "Return to route profile". ✨ -------------------------------------------------------------------------------- /content/tips/you-can-use-traits-inside-php-enums.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use traits inside PHP enums' 3 | tweet_id: '1495414934754136064' 4 | thread_slug: weekly-thread-2022-07 5 | author_username: archtechx 6 | images: 7 | - 'https://pbs.twimg.com/media/FL_ee0mVgAUuD-u.jpg' 8 | created_at: 2022-02-20T15:07:58+00:00 9 | slug: you-can-use-traits-inside-php-enums 10 | --- 11 | A few days ago, I learned that PHP enums can use traits 12 | 13 | It may seem like a massive anti-pattern, but it allows making enums actually awesome with this one trick 🔥 -------------------------------------------------------------------------------- /content/tips/you-can-use-use-wherebetween-to-filter-for-records-between-two-timestamps.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use use `whereBetween` to filter for records between two timestamps' 3 | tweet_id: '1509994023083147264' 4 | thread_slug: weekly-thread-2022-13 5 | author_username: ecrmnn 6 | images: 7 | - 'https://pbs.twimg.com/media/FO8rgMGXsAkX0SD.jpg' 8 | created_at: 2022-04-01T20:40:04+00:00 9 | slug: you-can-use-use-wherebetween-to-filter-for-records-between-two-timestamps 10 | --- 11 | How to retrieve records between two timestamps in Laravel 🗓 Use whereBetween with a from and to date. If you need to provide fallback you can do so with the nullish coalescing operator ❔❔ -------------------------------------------------------------------------------- /content/tips/you-can-use-value-to-fetch-a-single-value-from-the-database-without-having-to-instantiate-an-entire-model.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use value() to fetch a single value from the database, without having to instantiate an entire model' 3 | tweet_id: '1456649611796369411' 4 | thread_slug: weekly-thread-2021-44 5 | author_username: AzizullahSamim 6 | images: 7 | - 'https://pbs.twimg.com/media/FDL2wc2XMAYoIXr.jpg' 8 | created_at: 2021-11-05T15:48:25+00:00 9 | slug: you-can-use-value-to-fetch-a-single-value-from-the-database-without-having-to-instantiate-an-entire-model 10 | --- 11 | #Laravel Tip: 12 | If you want a single value from a database table. -------------------------------------------------------------------------------- /content/tips/you-can-use-where-on-rule-instances-without-passing-a-callback.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use ->where() on Rule instances without passing a callback' 3 | tweet_id: '1456649614300356615' 4 | thread_slug: weekly-thread-2021-44 5 | author_username: jbrooksuk 6 | images: 7 | - 'https://pbs.twimg.com/media/FDDdhwiXEAIY4vZ.jpg' 8 | created_at: 2021-11-05T15:48:25+00:00 9 | slug: you-can-use-where-on-rule-instances-without-passing-a-callback 10 | --- 11 | Did you know that you don't have to pass a function to Laravel's "where" method when using the Rule class? 12 | -------------------------------------------------------------------------------- /content/tips/you-can-use-wherenumber-on-routes-instead-of-passing-a-regex-pattern-to-where.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use whereNumber() on routes instead of passing a regex pattern to where()' 3 | tweet_id: '1495414943612506113' 4 | thread_slug: weekly-thread-2022-07 5 | author_username: Sileence 6 | images: 7 | - 'https://pbs.twimg.com/media/FLZ9iNEX0AcKQVD.jpg' 8 | created_at: 2022-02-20T15:08:00+00:00 9 | slug: you-can-use-wherenumber-on-routes-instead-of-passing-a-regex-pattern-to-where 10 | --- 11 | I'm reading the Laravel 9 docs from scratch and TIL you can write your route restrictions in a more expressive way: -------------------------------------------------------------------------------- /content/tips/you-can-use-wherexandy-in-eloquent.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can use where{X}and{Y}() in Eloquent' 3 | tweet_id: '1308100321164619777' 4 | thread_slug: 1-rt-1-tip 5 | author_username: samuelstancl 6 | images: 7 | - 'https://pbs.twimg.com/media/EidOOuTXYAYMtI9.png' 8 | created_at: 2020-09-21T17:46:34+00:00 9 | slug: you-can-use-wherexandy-in-eloquent 10 | --- 11 | 12 | Not recommended in most cases, but interesting. 13 | 14 | (image stolen from the internet) -------------------------------------------------------------------------------- /content/tips/you-can-validate-a-field-and-exclude-it-from-the-validated-data.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can validate a field and exclude it from the validated() data' 3 | tweet_id: '1520040281818550274' 4 | thread_slug: weekly-thread-2022-17 5 | author_username: mattkingshott 6 | images: 7 | - 'https://pbs.twimg.com/media/FRLzG4QXEAAOfyA.jpg' 8 | created_at: 2022-04-29T14:00:18+00:00 9 | slug: you-can-validate-a-field-and-exclude-it-from-the-validated-data 10 | --- 11 | 🔥 #Laravel Tip: When you need to validate a field, but don't actually require it for anything e.g. 'accept terms and conditions', make use of the 'exclude' rule. That way, the 'validated' method won't return it... -------------------------------------------------------------------------------- /content/tips/you-can-validate-data-at-the-database-level.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can validate data at the database level' 3 | tweet_id: '1505269891535818754' 4 | thread_slug: weekly-thread-2022-11 5 | author_username: tobias_petry 6 | images: 7 | - 'https://pbs.twimg.com/media/FN-JmJCXEAUCQjy.jpg' 8 | created_at: 2022-03-19T19:48:03+00:00 9 | slug: you-can-validate-data-at-the-database-level 10 | --- 11 | ⚡️ Database Tip 12 | 13 | Your application will have bugs and any data stored may be corrupt forever. But with constraints on the data model, rules would have prevented saving incorrect data in the first place! Use them as a last frontier to make sure you always have valid data. -------------------------------------------------------------------------------- /content/tips/you-can-validate-json-columns-at-database-level.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can validate JSON columns at database level' 3 | tweet_id: '1545466000790892544' 4 | thread_slug: weekly-thread-2022-27 5 | author_username: tobias_petry 6 | images: 7 | - 'https://pbs.twimg.com/media/FW-NXH9X0AE4uSd.jpg' 8 | created_at: 2022-07-08T17:53:02+00:00 9 | slug: you-can-validate-json-columns-at-database-level 10 | --- 11 | ⚡️ Database Tip 12 | 13 | Extending a traditional database schema with NoSQL-like JSON columns can make the schema more understandable. But you should also ensure these JSON documents conform to an expected schema! 14 | 15 | https://sqlfordevs.com/json-schema-validation 16 | -------------------------------------------------------------------------------- /content/tips/you-can-validate-json-columns-at-the-database-level.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can validate JSON columns at the database level' 3 | tweet_id: '1520040296930705408' 4 | thread_slug: weekly-thread-2022-17 5 | author_username: tobias_petry 6 | images: 7 | - 'https://pbs.twimg.com/media/FRQ0DmDXsAE_gbI.jpg' 8 | created_at: 2022-04-29T14:00:22+00:00 9 | slug: you-can-validate-json-columns-at-the-database-level 10 | --- 11 | ⚡️ Database Tip 12 | 13 | Extending a traditional database schema with NoSQL-like JSON columns can make the schema more understandable. But you should also ensure these JSON documents conform to an expected schema! 14 | 15 | https://sqlfordevs.com/json-schema-validation 16 | -------------------------------------------------------------------------------- /content/tips/you-can-validate-user-input-inside-middleware.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can validate user input inside middleware' 3 | tweet_id: '1466810183431032836' 4 | thread_slug: weekly-thread-2021-48 5 | author_username: JuanDMeGon 6 | images: 7 | - 'https://pbs.twimg.com/media/FFK5Rd-XwAAQ-g5.jpg' 8 | created_at: 2021-12-03T16:42:54+00:00 9 | slug: you-can-validate-user-input-inside-middleware 10 | --- 11 | ✔ You can validate fields even within a middleware in Laravel. 12 | 13 | This would help when you need to constantly validate the same field(s) on your requests: -------------------------------------------------------------------------------- /content/tips/you-can-validate-values-for-enum-database-columns-using-the-new-enum-validation-rule.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'You can validate values for enum database columns using the new Enum validation rule' 3 | tweet_id: '1461703826033897473' 4 | thread_slug: weekly-thread-2021-46 5 | author_username: sky_0xs 6 | images: 7 | - 'https://pbs.twimg.com/media/FEBiZ_-WQAQv1fY.jpg' 8 | created_at: 2021-11-19T14:32:03+00:00 9 | slug: you-can-validate-values-for-enum-database-columns-using-the-new-enum-validation-rule 10 | --- 11 | #Laravel Updates: 12 | 13 | In Laravel `8.7` you can now validate `enum` columns! 14 | 15 | An Example: -------------------------------------------------------------------------------- /content/tips/your-cli-commands-in-laravel-can-provide-auto-complete-for-the-terminal.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Your CLI commands in Laravel can provide auto-complete for the terminal' 3 | tweet_id: '1482036564746129410' 4 | thread_slug: weekly-thread-2022-02 5 | author_username: AshAllenDesign 6 | images: 7 | - 'https://pbs.twimg.com/media/FI-pr9tXEAURLrX.jpg' 8 | created_at: 2022-01-14T17:07:06+00:00 9 | slug: your-cli-commands-in-laravel-can-provide-auto-complete-for-the-terminal 10 | --- 11 | Did you know that you can provide auto-complete hints for your commands in Laravel? 12 | 13 | These can be pretty helpful in your internal CLI tools that you have in your projects 🚀 14 | 15 | #laravel #php -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | *.sqlite-journal 3 | -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archtechx/laravel-tips/2d53681753d922d8d1a6f899f44c4ced6fb0a834/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archtechx/laravel-tips/2d53681753d922d8d1a6f899f44c4ced6fb0a834/public/favicon-16x16.png -------------------------------------------------------------------------------- /public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archtechx/laravel-tips/2d53681753d922d8d1a6f899f44c4ced6fb0a834/public/favicon-32x32.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archtechx/laravel-tips/2d53681753d922d8d1a6f899f44c4ced6fb0a834/public/favicon.ico -------------------------------------------------------------------------------- /public/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/js/app.js": "/js/app.js?id=67ee2aea12150f13c1ae", 3 | "/css/app.css": "/css/app.css?id=03724ac5e1043bfed729" 4 | } 5 | -------------------------------------------------------------------------------- /public/og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/archtechx/laravel-tips/2d53681753d922d8d1a6f899f44c4ced6fb0a834/public/og.png -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss/base"; 2 | @import "tailwindcss/components"; 3 | @import "tailwindcss/utilities"; 4 | 5 | @layer base { 6 | .prose a { 7 | @apply relative; 8 | } 9 | } 10 | 11 | .break-smart { 12 | @apply break-all; 13 | } 14 | 15 | @screen sm { 16 | .break-smart { 17 | word-break: normal !important; 18 | 19 | @apply break-words; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import * as Turbo from "@hotwired/turbo" 2 | 3 | window.Turbo = Turbo; 4 | 5 | import 'alpine-turbo-drive-adapter' 6 | import 'alpinejs' 7 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/views/components/container.blade.php: -------------------------------------------------------------------------------- 1 |
{{ $slot }}
2 | -------------------------------------------------------------------------------- /resources/views/components/link.blade.php: -------------------------------------------------------------------------------- 1 | class('inline transition border-b-2 border-gray-200 hover:border-orange-500 focus:outline-none focus:border-orange-600') }}>{{ $slot }} 2 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /static/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | const colors = require("tailwindcss/colors"); 2 | const defaultTheme = require("tailwindcss/defaultTheme"); 3 | 4 | module.exports = { 5 | purge: ["./resources/views/**/*.blade.php"], 6 | 7 | mode: "jit", 8 | 9 | darkMode: "class", 10 | 11 | theme: { 12 | extend: { 13 | fontFamily: { 14 | sans: ["iA Writer Quattro S", ...defaultTheme.fontFamily.sans], 15 | }, 16 | 17 | colors: { 18 | ...colors, 19 | }, 20 | }, 21 | }, 22 | 23 | plugins: [require("@tailwindcss/typography")], 24 | }; 25 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | --------------------------------------------------------------------------------