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

initial commit

This commit is contained in:
Samuel Štancl 2021-04-06 18:27:18 +02:00
commit 1beb9dd34c
281 changed files with 56773 additions and 0 deletions

21
test/.htaccess Normal file
View file

@ -0,0 +1,21 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

View file

@ -0,0 +1 @@
show {"username":"LiamHammett","avatar":"https:\/\/pbs.twimg.com\/profile_images\/1236048705297485837\/oGeWeWid_normal.jpg","name":"Liam Hammett","content":""}

1
test/authors/index.html Normal file
View file

@ -0,0 +1 @@
author index

View file

@ -0,0 +1 @@
show {"username":"reinink","avatar":"https:\/\/pbs.twimg.com\/profile_images\/885868801232961537\/b1F6H4KC_normal.jpg","name":"Jonathan Reinink","content":""}

View file

@ -0,0 +1 @@
show {"username":"samuelstancl","avatar":"https:\/\/pbs.twimg.com\/profile_images\/1257272213088190464\/8kuysprf_normal.jpg","name":"Samuel \u0160tancl","content":""}

View file

@ -0,0 +1 @@
show {"username":"timacdonald87","avatar":"https:\/\/pbs.twimg.com\/profile_images\/1249274319059841024\/-8bpTPMC_normal.jpg","name":"Tim MacDonald","content":""}

1059
test/css/app.css vendored Normal file

File diff suppressed because it is too large Load diff

0
test/favicon.ico Normal file
View file

1
test/foo.txt Normal file
View file

@ -0,0 +1 @@
abc

55
test/index.php Normal file
View file

@ -0,0 +1,55 @@
<?php
use Illuminate\Contracts\Http\Kernel;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Check If The Application Is Under Maintenance
|--------------------------------------------------------------------------
|
| If the application is in maintenance / demo mode via the "down" command
| we will load this file so that any pre-rendered content can be shown
| instead of starting the framework, which could cause an exception.
|
*/
if (file_exists(__DIR__.'/../storage/framework/maintenance.php')) {
require __DIR__.'/../storage/framework/maintenance.php';
}
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| this application. We just need to utilize it! We'll simply require it
| into the script here so we don't need to manually load our classes.
|
*/
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request using
| the application's HTTP kernel. Then, we will send the response back
| to this client's browser, allowing them to enjoy our application.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
$kernel = $app->make(Kernel::class);
$response = tap($kernel->handle(
$request = Request::capture()
))->send();
$kernel->terminate($request, $response);

4907
test/js/app.js vendored Normal file

File diff suppressed because it is too large Load diff

4
test/mix-manifest.json Normal file
View file

@ -0,0 +1,4 @@
{
"/js/app.js": "/js/app.js?id=a136d2a5a73d65f4c129",
"/css/app.css": "/css/app.css?id=d5acc62a4ce7a6842556"
}

2
test/robots.txt Normal file
View file

@ -0,0 +1,2 @@
User-agent: *
Disallow:

View file

@ -0,0 +1 @@
show {"slug":"1-rt-1-tip","title":"1 RT = 1 tip","tweet_id":"1308082888324374528","created_at":"1617451294","content":"A thread of misc tips, originally one tip per one retweet."}

View file

@ -0,0 +1 @@
show {"slug":"abc","title":"abc","tweet_id":"1272822437181378561","created_at":"2021-04-02 14:18:47","content":"foo"}

View file

@ -0,0 +1 @@
show {"slug":"def","title":"def","tweet_id":"1308082888324374528","created_at":"2021-04-02 14:19:02","content":"bar"}

1
test/threads/index.html Normal file
View file

@ -0,0 +1 @@
thread index

View file

@ -0,0 +1 @@
show {"slug":"laravel-clean-code-tactics","title":"Laravel Clean Code Tactics","tweet_id":"1272822437181378561","created_at":"1617451278","content":"Get the PDF versions [here](https:\/\/gum.co\/laravel-clean-code)"}

View file

@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">1. People underutilize the exception handler.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Eic5sfxWAAY2ym2.png?name=large" target="_blank">
<img alt="1. People underutilize the exception handler." src="https://pbs.twimg.com/media/Eic5sfxWAAY2ym2.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol>
<li>People underutilize the exception handler.</li>
</ol>
<p>You can tell the app what response to return when a specific exception is encountered.</p>
<p>This is the simplest example. There's many more use cases. <a href="https://t.co/diMoktScI3">https://t.co/diMoktScI3</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308082889561604102" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,92 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">10. If you want to identify teams, workspaces, etc by path, you don&#039;t have to pass the team ID to every route.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidKFFnX0AEEjwr.png?name=large" target="_blank">
<img alt="10. If you want to identify teams, workspaces, etc by path, you don&#039;t have to pass the team ID to every route." src="https://pbs.twimg.com/media/EidKFFnX0AEEjwr.png?name=small">
</a>
<a href="https://pbs.twimg.com/media/EidKYlkWoAAWkLD.png?name=large" target="_blank">
<img alt="10. If you want to identify teams, workspaces, etc by path, you don&#039;t have to pass the team ID to every route." src="https://pbs.twimg.com/media/EidKYlkWoAAWkLD.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="10">
<li>If you want to identify teams, workspaces, etc by path, you don't have to pass the team ID to every route.</li>
</ol>
<p>In the example below, the value reaches the middleware, where you can do some stuff, and then is REMOVED from the route parameters before being passed to the action. <a href="https://t.co/3TNUnucmz3">https://t.co/3TNUnucmz3</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308096302530600963" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">11. You can use where{X}and{Y}() in Eloquent.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidOOuTXYAYMtI9.png?name=large" target="_blank">
<img alt="11. You can use where{X}and{Y}() in Eloquent." src="https://pbs.twimg.com/media/EidOOuTXYAYMtI9.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="11">
<li>You can use where{X}and{Y}() in Eloquent.</li>
</ol>
<p>Not recommended in most cases, but interesting.</p>
<p>(image stolen from the internet) <a href="https://t.co/8kKmRUYi8e">https://t.co/8kKmRUYi8e</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308100321164619777" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">13. If you&#039;re debugging your app and you&#039;d like to examine more things - e.g. the stack trace, executed queries, app context, ...</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidXEVXXgAofRdr.jpg?name=large" target="_blank">
<img alt="13. If you&#039;re debugging your app and you&#039;d like to examine more things - e.g. the stack trace, executed queries, app context, ..." src="https://pbs.twimg.com/media/EidXEVXXgAofRdr.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="13">
<li>If you're debugging your app and you'd like to examine more things - e.g. the stack trace, executed queries, app context, ...</li>
</ol>
<p>You can use ddd() instead of dd().</p>
<p>I tend to forget about this one, but it's super useful. <a href="https://t.co/hjVNOeLTRI">https://t.co/hjVNOeLTRI</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308109980504133633" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">14. Comparing changes on &#039;saving&#039; using:</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidZs1IWAAUgH0m.png?name=large" target="_blank">
<img alt="14. Comparing changes on &#039;saving&#039; using:" src="https://pbs.twimg.com/media/EidZs1IWAAUgH0m.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="14">
<li>Comparing changes on 'saving' using:</li>
</ol>
<p>$model-&amp;gt;getOriginal()</p>
<p>in Eloquent event listeners can be very useful.</p>
<p>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. <a href="https://t.co/rDD1ziOapj">https://t.co/rDD1ziOapj</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308113281018728450" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">15.1. Eloquent listeners are awesome.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidaLtrXcAU0nIG.png?name=large" target="_blank">
<img alt="15.1. Eloquent listeners are awesome." src="https://pbs.twimg.com/media/EidaLtrXcAU0nIG.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>15.1. Eloquent listeners are awesome.</p>
<p>Example: Default value set on creation. <a href="https://t.co/eXVC8WR0xV">https://t.co/eXVC8WR0xV</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308114698299154433" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">15.2. Example: Deleting associated files on deletion. https://t.co/4j8UZU0ZYy</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidbEGZXYAA6q3G.png?name=large" target="_blank">
<img alt="15.2. Example: Deleting associated files on deletion. https://t.co/4j8UZU0ZYy" src="https://pbs.twimg.com/media/EidbEGZXYAA6q3G.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>15.2. Example: Deleting associated files on deletion. <a href="https://t.co/4j8UZU0ZYy">https://t.co/4j8UZU0ZYy</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308114699913961472" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">15.3. Example: Checking a parent relationship for some things.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidbX_UWAAMeB6-.png?name=large" target="_blank">
<img alt="15.3. Example: Checking a parent relationship for some things." src="https://pbs.twimg.com/media/EidbX_UWAAMeB6-.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>15.3. Example: Checking a parent relationship for some things.</p>
<p>Such as, checking if an Order is locked inside an OrderProduct.</p>
<p>OrderProducts cannot be added to/changed in a locked order. <a href="https://t.co/4v8iIkebPk">https://t.co/4v8iIkebPk</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308114701415571457" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">17. Laravel migrations have a very nice syntax for foreign keys.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="17">
<li>Laravel migrations have a very nice syntax for foreign keys.</li>
</ol>
<p>I didn't know about this for so long.</p>
<p>Instead of:
$table-&amp;gt;unsignedBigInteger('user_id');
$table-&amp;gt;foreign('user_id')-&amp;gt;references('id')-&amp;gt;on('users');</p>
<p>You do:
$table-&amp;gt;foreignId('user_id')-&amp;gt;constrained();</p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308126491188883463" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">18. You can return &quot;false&quot; from a -ing() Eloquent event listener (creating, updating, saving, deleting) to cancel the action.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Eidmle3WoAI72Yk.png?name=large" target="_blank">
<img alt="18. You can return &quot;false&quot; from a -ing() Eloquent event listener (creating, updating, saving, deleting) to cancel the action." src="https://pbs.twimg.com/media/Eidmle3WoAI72Yk.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="18">
<li>You can return &quot;false&quot; from a -ing() Eloquent event listener (creating, updating, saving, deleting) to cancel the action.</li>
</ol>
<p>This is similar to how I was throwing an exception based on certain things in the example with order locking. <a href="https://t.co/fg5z2TWGZx">https://t.co/fg5z2TWGZx</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308127034565066766" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">2. You can return Mailables as responses from controllers. It will show the rendered version in the browser.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Eic6iydX0AgLupY.png?name=large" target="_blank">
<img alt="2. You can return Mailables as responses from controllers. It will show the rendered version in the browser." src="https://pbs.twimg.com/media/Eic6iydX0AgLupY.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="2">
<li>You can return Mailables as responses from controllers. It will show the rendered version in the browser.</li>
</ol>
<p>Great for debugging/tweaking the design. <a href="https://t.co/bdB22XLnHz">https://t.co/bdB22XLnHz</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308082892162162690" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">20.1. This won&#039;t fit into one tweet but there&#039;s so much cool stuff you can do with Eloquent.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Eidq5A3XsAAM9lA.png?name=large" target="_blank">
<img alt="20.1. This won&#039;t fit into one tweet but there&#039;s so much cool stuff you can do with Eloquent." src="https://pbs.twimg.com/media/Eidq5A3XsAAM9lA.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>20.1. This won't fit into one tweet but there's so much cool stuff you can do with Eloquent.</p>
<p>You DON'T have to go raw SQL when you hit a performance issue with Eloquent. There's so many &quot;secret&quot; techniques.</p>
<p>Example: You can create scopes to add specific selects to your queries. <a href="https://t.co/YrIWlKf2K7">https://t.co/YrIWlKf2K7</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308134105389953024" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">20.2 You can create dynamic relationships — this relationship is based on a column that&#039;s added using a subquery, in a scope.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidrdqwWkAIy4oN.png?name=large" target="_blank">
<img alt="20.2 You can create dynamic relationships — this relationship is based on a column that&#039;s added using a subquery, in a scope." src="https://pbs.twimg.com/media/EidrdqwWkAIy4oN.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>20.2 You can create dynamic relationships — this relationship is based on a column that's added using a subquery, in a scope.</p>
<p>And so much more. <a href="https://t.co/EqVABRXKQJ">https://t.co/EqVABRXKQJ</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308134107118022666" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">21. You can add a tags() method to a job. Anything you return from this method will be displayed in Horizon.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidtAYaXkAEjAl-.jpg?name=large" target="_blank">
<img alt="21. You can add a tags() method to a job. Anything you return from this method will be displayed in Horizon." src="https://pbs.twimg.com/media/EidtAYaXkAEjAl-.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="21">
<li>You can add a tags() method to a job. Anything you return from this method will be displayed in Horizon.</li>
</ol>
<p>Very useful if you want to tag jobs with things like the user/tenant id. <a href="https://t.co/cpg1Zp5BPu">https://t.co/cpg1Zp5BPu</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308134110595084288" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">24. This one is less obscure.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidvI20XcAA7MGY.png?name=large" target="_blank">
<img alt="24. This one is less obscure." src="https://pbs.twimg.com/media/EidvI20XcAA7MGY.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="24">
<li>This one is less obscure.</li>
</ol>
<p>The $loop variable.</p>
<p>It greatly complements Tailwind-styled tables.</p>
<p>Striped tables done easily 🎉 <a href="https://t.co/prm735AEuN">https://t.co/prm735AEuN</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308136547217281026" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">25. You can explicitly bind objects to routes. You don&#039;t have to use route model binding only. Custom objects work perfectly well too.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidyDmfWsAI14-C.png?name=large" target="_blank">
<img alt="25. You can explicitly bind objects to routes. You don&#039;t have to use route model binding only. Custom objects work perfectly well too." src="https://pbs.twimg.com/media/EidyDmfWsAI14-C.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="25">
<li>You can explicitly bind objects to routes. You don't have to use route model binding only. Custom objects work perfectly well too.</li>
</ol>
<p>This example is from Tenancy v2 when we had an ActiveRecord-style custom Tenant object. <a href="https://t.co/kydWSrcmer">https://t.co/kydWSrcmer</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308140146374696962" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">3.1. There&#039;s 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 PHP/Laravel App state.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Eic9xP2XsAoo8ay.png?name=large" target="_blank">
<img alt="3.1. There&#039;s 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 PHP/Laravel App state." src="https://pbs.twimg.com/media/Eic9xP2XsAoo8ay.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>3.1. There's 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 PHP/Laravel App state.</p>
<p>For example, use $model-&amp;gt;is($anotherModel) to check if they refer to the same row. <a href="https://t.co/kBquNQYPgA">https://t.co/kBquNQYPgA</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308082893865005068" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">3.2. When a relationship is already loaded and &quot;cached&quot; on the model instance, you&#039;ll have to refresh it.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Eic_JawXgAAEbYL.png?name=large" target="_blank">
<img alt="3.2. When a relationship is already loaded and &quot;cached&quot; on the model instance, you&#039;ll have to refresh it." src="https://pbs.twimg.com/media/Eic_JawXgAAEbYL.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>3.2. When a relationship is already loaded and &quot;cached&quot; on the model instance, you'll have to refresh it.</p>
<p><code>$domain-&amp;amp;gt;refresh();</code> to refresh its attributes</p>
<p><code>$tenant-&amp;amp;gt;load(&amp;#039;primary_domain&amp;#039;);</code> to update the <code>primary_domain</code> relationship on the $tenant instance <a href="https://t.co/FdzT5rilEr">https://t.co/FdzT5rilEr</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308084124947820554" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">4. Laravel Nova lets you show different resources/tools/cards/... based on an if check.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidABmBXcAAto9_.png?name=large" target="_blank">
<img alt="4. Laravel Nova lets you show different resources/tools/cards/... based on an if check." src="https://pbs.twimg.com/media/EidABmBXcAAto9_.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="4">
<li>Laravel Nova lets you show different resources/tools/cards/... based on an if check.</li>
</ol>
<p>Extremely handy when you have multiple admin panels in a single app. <a href="https://t.co/3HvDb1Ae3N">https://t.co/3HvDb1Ae3N</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308084774586773510" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">5. Closure validation rules are 🔥. They&#039;re often better than creating a class just for a single use.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidAtSYXgAc-6tH.png?name=large" target="_blank">
<img alt="5. Closure validation rules are 🔥. They&#039;re often better than creating a class just for a single use." src="https://pbs.twimg.com/media/EidAtSYXgAc-6tH.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="5">
<li>Closure validation rules are 🔥. They're often better than creating a class just for a single use.</li>
</ol>
<p>Create a class if it's used on multiple places or way too complex. <a href="https://t.co/nslCQb8pDh">https://t.co/nslCQb8pDh</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308085658095886336" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">6. Relevant for people building packages 📦</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidBy75XsA4CZGx.jpg?name=large" target="_blank">
<img alt="6. Relevant for people building packages 📦" src="https://pbs.twimg.com/media/EidBy75XsA4CZGx.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="6">
<li>Relevant for people building packages 📦</li>
</ol>
<p>It's IMO better to use static properties and have &quot;self-contained&quot; behavior &amp;amp; configuration. Than to have a billion config keys. Especially when building large packages.</p>
<p>Makes the package more extensible, by consisting of atomic parts <a href="https://t.co/tyucZmkmsz">https://t.co/tyucZmkmsz</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308086649184751619" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=3114380fe137a49f1bea">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">9. Laravel Telescope is great for so many things.</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidI3vCXgAIOCvY.png?name=large" target="_blank">
<img alt="9. Laravel Telescope is great for so many things." src="https://pbs.twimg.com/media/EidI3vCXgAIOCvY.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<ol start="9">
<li>Laravel Telescope is great for so many things.</li>
</ol>
<p>One of them is examining sent emails ✉️</p>
<p>You usually don't need a service like Mailtrap. Just use the <code>log</code> mail driver and install Telescope.</p>
<p>(image stolen from the internet) <a href="https://t.co/odX4ZHzHE3">https://t.co/odX4ZHzHE3</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://laravel-tips.test/threads/def">
def
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308094765544734720" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Avoid helper *classes*</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean2CnyWoAEZ3Ef.jpg?name=large" target="_blank">
<img alt="Avoid helper *classes*" src="https://pbs.twimg.com/media/Ean2CnyWoAEZ3Ef.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Sometimes people put helpers into a class.</p>
<p>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. <a href="https://t.co/iIcyReIW9N">https://t.co/iIcyReIW9N</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822458563821568" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Avoid queries in Blade when possible</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean7jvPWkAAp2_6.jpg?name=large" target="_blank">
<img alt="Avoid queries in Blade when possible" src="https://pbs.twimg.com/media/Ean7jvPWkAAp2_6.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Sometimes you may want to execute DB queries in blade. There are some ok use cases for this, such as in layout files.</p>
<p>But if it's a view returned by a controller, pass the data in the view data instead. <a href="https://t.co/olodRS3N9s">https://t.co/olodRS3N9s</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826450559803392" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Be friends with your IDE</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean6t2ZXgAEiJMa.jpg?name=large" target="_blank">
<img alt="Be friends with your IDE" src="https://pbs.twimg.com/media/Ean6t2ZXgAEiJMa.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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. <a href="https://t.co/xNMR2UHed7">https://t.co/xNMR2UHed7</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826441424613378" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Closure validation rules are 🔥. They&#039;re often better than creating a class just for a single use</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidAtSYXgAc-6tH.png?name=large" target="_blank">
<img alt="Closure validation rules are 🔥. They&#039;re often better than creating a class just for a single use" src="https://pbs.twimg.com/media/EidAtSYXgAc-6tH.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Create a class if it's used on multiple places or way too complex. <a href="https://t.co/nslCQb8pDh">https://t.co/nslCQb8pDh</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308085658095886336" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Comparing changes on &#039;saving&#039; using:</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidZs1IWAAUgH0m.png?name=large" target="_blank">
<img alt="Comparing changes on &#039;saving&#039; using:" src="https://pbs.twimg.com/media/EidZs1IWAAUgH0m.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>$model-&gt;getOriginal()</p>
<p>in Eloquent event listeners can be very useful.</p>
<p>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. <a href="https://t.co/rDD1ziOapj">https://t.co/rDD1ziOapj</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308113281018728450" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Consider single-action controllers</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean6Sn9XkAA-WKS.png?name=large" target="_blank">
<img alt="Consider single-action controllers" src="https://pbs.twimg.com/media/Ean6Sn9XkAA-WKS.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>If you have a complex route action, consider moving it to a separate controller.</p>
<p>For OrderController::create, you'd create CreateOrderController.</p>
<p>Another solution is to move that logic to an action class — do what works best in your case. <a href="https://t.co/Rn6lFnhkVH">https://t.co/Rn6lFnhkVH</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826438891298816" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Consider using form requests</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean0kWgXgAAcOXm.jpg?name=large" target="_blank">
<img alt="Consider using form requests" src="https://pbs.twimg.com/media/Ean0kWgXgAAcOXm.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>They're a great place to hide complex validation logic.</p>
<p>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 <a href="https://t.co/RwzDxANxXj">https://t.co/RwzDxANxXj</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822452201144321" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Consider using helpers instead of facades. They can clean things up</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean7QGBXYAEt_l2.jpg?name=large" target="_blank">
<img alt="Consider using helpers instead of facades. They can clean things up" src="https://pbs.twimg.com/media/Ean7QGBXYAEt_l2.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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.</p>
<p>Bonus points for session('key') syntax. <a href="https://t.co/AbMzJl4Puz">https://t.co/AbMzJl4Puz</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826446717870081" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Context matters</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean8vC0WAAEomIq.jpg?name=large" target="_blank">
<img alt="Context matters" src="https://pbs.twimg.com/media/Ean8vC0WAAEomIq.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Above I said that moving business logic to action/service classes is good. But context matters</p>
<p>Here's code design advice from a popular &quot;Laravel best practices&quot; repo. There's absolutely no reason to put a 3-line check into a class. That's just overengineered <a href="https://t.co/zOtKmaVtMu">https://t.co/zOtKmaVtMu</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826465378357251" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Create action classes</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean0gvIWsAAIfxK.jpg?name=large" target="_blank">
<img alt="Create action classes" src="https://pbs.twimg.com/media/Ean0gvIWsAAIfxK.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Let's expand on the previous example. Sometimes, creating a class for a single action can clean things up.</p>
<p>Models should encapsulate the business logic related to them, but they shouldn't be too big. <a href="https://t.co/Mll37AAh5o">https://t.co/Mll37AAh5o</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822450137546753" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Create custom Blade directives for business logic</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean7bYSXkAIwDIR.png?name=large" target="_blank">
<img alt="Create custom Blade directives for business logic" src="https://pbs.twimg.com/media/Ean7bYSXkAIwDIR.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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. <a href="https://t.co/FY5CMi4gVP">https://t.co/FY5CMi4gVP</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826448810737670" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Create fluent objects</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean3zqXWAAASnOP.png?name=large" target="_blank">
<img alt="Create fluent objects" src="https://pbs.twimg.com/media/Ean3zqXWAAASnOP.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>You can also create objects with fluent APIs. Gradually add data by with separate calls, and only require the absolute minimum in the constructor.</p>
<p>Each method will return $this, so you can stop at any call. <a href="https://t.co/826OBHPEAX">https://t.co/826OBHPEAX</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822468219109377" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Create helper functions</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean1ow4WoAAFjoT.jpg?name=large" target="_blank">
<img alt="Create helper functions" src="https://pbs.twimg.com/media/Ean1ow4WoAAFjoT.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>If you repeat some code a lot, consider if extracting it to a helper function would make the code cleaner. <a href="https://t.co/2e4TtoVn9N">https://t.co/2e4TtoVn9N</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822457011970048" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Create model methods for business logic</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean0WGiWAAAg4cu.jpg?name=large" target="_blank">
<img alt="Create model methods for business logic" src="https://pbs.twimg.com/media/Ean0WGiWAAAg4cu.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Your controllers should be simple. They should say things like &quot;create invoice for order&quot;. They shouldn't be concerned with the details of how your database is structured.</p>
<p>Leave that to the model. <a href="https://t.co/1w1s2sbwkO">https://t.co/1w1s2sbwkO</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822448145272832" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Create query scopes for complex where()s</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean5ymtXgAEvlxm.jpg?name=large" target="_blank">
<img alt="Create query scopes for complex where()s" src="https://pbs.twimg.com/media/Ean5ymtXgAEvlxm.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Rather than writing complex where() clauses, create query scopes with expressive names.</p>
<p>This will make your e.g. controllers have to know less about the database structure and your code will be cleaner. <a href="https://t.co/mqxugYM4oG">https://t.co/mqxugYM4oG</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826431609933825" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Create single-use Blade includes</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Similar to single-use traits.</p>
<p>This tactic is great when you have a very long template and you want to make it more manageable.</p>
<p>There's nothing wrong with @including headers and footers in layouts, or things like complex forms in page views.</p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826427902234625" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Create single-use traits</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean5BnEWkAEPUTe.jpg?name=large" target="_blank">
<img alt="Create single-use traits" src="https://pbs.twimg.com/media/Ean5BnEWkAEPUTe.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Adding methods to classes where they belong is cleaner than creating action classes for everything, but it can make the classes grow big</p>
<p>Consider using traits. They're meant <em>primarily</em> for code reuse, but there's nothing wrong with single-use traits <a href="https://t.co/dWWLNWuOoS">https://t.co/dWWLNWuOoS</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822478260363265" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Create variables when they improve readability</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean0HJwWAAAZkDR.png?name=large" target="_blank">
<img alt="Create variables when they improve readability" src="https://pbs.twimg.com/media/Ean0HJwWAAAZkDR.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>The opposite of the previous tip. Sometimes the value comes from a complex call and as such, creating a variable improves readability &amp; removes the need for a comment.</p>
<p>Remember that context matters &amp; your end goal is readability <a href="https://t.co/hwFni2X6zA">https://t.co/hwFni2X6zA</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822446278750208" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Dedicate a weekend towards learning proper OOP</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Know the difference between static/instance methods &amp; variables and private/protected/public visibility. Also learn how Laravel uses magic methods.</p>
<p>You don't need this as a beginner, but as your code grows, it's crucial.</p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822460631539712" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Don&#039;t create variables when you can just pass the value directly. https://t.co/S8VOzn7aOr</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Eanz9WJWkAAeoT2.jpg?name=large" target="_blank">
<img alt="Don&#039;t create variables when you can just pass the value directly. https://t.co/S8VOzn7aOr" src="https://pbs.twimg.com/media/Eanz9WJWkAAeoT2.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822444621991937" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Don&#039;t just write procedural code in classes</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean2u-YX0AEmwEd.jpg?name=large" target="_blank">
<img alt="Don&#039;t just write procedural code in classes" src="https://pbs.twimg.com/media/Ean2u-YX0AEmwEd.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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.</p>
<p>Here's code from my first Laravel project 😬 <a href="https://t.co/2DeGX148Wh">https://t.co/2DeGX148Wh</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822462040899584" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Don&#039;t split lines at random places, but don&#039;t make them too long either</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Eanz0jnXsAAvkv1.jpg?name=large" target="_blank">
<img alt="Don&#039;t split lines at random places, but don&#039;t make them too long either" src="https://pbs.twimg.com/media/Eanz0jnXsAAvkv1.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Opening an array with [ and indenting the values tends to work well. Same with long function parameter values.</p>
<p>Other good places to split lines are chained calls and closures. <a href="https://t.co/bnTL2I0Bxa">https://t.co/bnTL2I0Bxa</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822442990473216" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Don&#039;t use a controller namespace</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean6NFJX0AAfiXT.png?name=large" target="_blank">
<img alt="Don&#039;t use a controller namespace" src="https://pbs.twimg.com/media/Ean6NFJX0AAfiXT.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Instead of writing controller actions like PostController@index, use the callable array syntax [PostController::class, 'index'].</p>
<p>You will be able to navigate to the class by clicking PostController. <a href="https://t.co/h2UF1te3E3">https://t.co/h2UF1te3E3</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826437167468544" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Don&#039;t use abbreviations</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean4TBBXgAAMab3.png?name=large" target="_blank">
<img alt="Don&#039;t use abbreviations" src="https://pbs.twimg.com/media/Ean4TBBXgAAMab3.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Don't think that long variable/method names are wrong. They're not. They're expressive.</p>
<p>Better to call a longer method than a short one and check the docblock to understand what it does</p>
<p>Same with variables. Don't use nonsense 3-letters abbreviations <a href="https://t.co/a23I1L7TtW">https://t.co/a23I1L7TtW</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822472329572355" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Don&#039;t use model methods to retrieve data</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean58GjWAAAgqLq.jpg?name=large" target="_blank">
<img alt="Don&#039;t use model methods to retrieve data" src="https://pbs.twimg.com/media/Ean58GjWAAAgqLq.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>If you want to retrieve some data from a model, create an accessor.</p>
<p>Keep methods for things that <em>change</em> the model in some way. <a href="https://t.co/3IpmbDuNF9">https://t.co/3IpmbDuNF9</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826433417752576" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Eloquent listeners are awesome</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidaLtrXcAU0nIG.png?name=large" target="_blank">
<img alt="Eloquent listeners are awesome" src="https://pbs.twimg.com/media/EidaLtrXcAU0nIG.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Example: Default value set on creation. <a href="https://t.co/eXVC8WR0xV">https://t.co/eXVC8WR0xV</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308114698299154433" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Example: Checking a parent relationship for some things</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidbX_UWAAMeB6-.png?name=large" target="_blank">
<img alt="Example: Checking a parent relationship for some things" src="https://pbs.twimg.com/media/EidbX_UWAAMeB6-.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Such as, checking if an Order is locked inside an OrderProduct.</p>
<p>OrderProducts cannot be added to/changed in a locked order. <a href="https://t.co/4v8iIkebPk">https://t.co/4v8iIkebPk</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308114701415571457" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Example: Deleting associated files on deletion. https://t.co/4j8UZU0ZYy</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidbEGZXYAA6q3G.png?name=large" target="_blank">
<img alt="Example: Deleting associated files on deletion. https://t.co/4j8UZU0ZYy" src="https://pbs.twimg.com/media/EidbEGZXYAA6q3G.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308114699913961472" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Extract methods</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean1UORWkAE4UDD.jpg?name=large" target="_blank">
<img alt="Extract methods" src="https://pbs.twimg.com/media/Ean1UORWkAE4UDD.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>If some method is too long or complex, and it's hard to understand what exactly is happening, split the logic into multiple methods. <a href="https://t.co/ljFm6RFk8i">https://t.co/ljFm6RFk8i</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822455393026049" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Have a single source of truth for validation rules</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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.</p>
<p><a href="https://t.co/qI1Q0HUEyK">https://t.co/qI1Q0HUEyK</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826456960315392" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Here&#039;s another example of the Model state stuff mentioned above</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidDSDcXYAA_7XD.jpg?name=large" target="_blank">
<img alt="Here&#039;s another example of the Model state stuff mentioned above" src="https://pbs.twimg.com/media/EidDSDcXYAA_7XD.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Except...</p>
<p>It's multi-tenant!</p>
<p>Tip 7: It's incredibly easy to use <a href="https://t.co/XDsbINZGoO">https://t.co/XDsbINZGoO</a> with Tinker 😎 <a href="https://t.co/kyk0A0te2M">https://t.co/kyk0A0te2M</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308088600278560768" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 If you didn&#039;t know, @LaravelLivewire now triggers &quot;updated&quot; and &quot;updating&quot; hooks for nested properties, which works with both array and model properties! https://t.co/0RtwRPgfld</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EiXw7FcXYAEGzFy.jpg?name=large" target="_blank">
<img alt="If you didn&#039;t know, @LaravelLivewire now triggers &quot;updated&quot; and &quot;updating&quot; hooks for nested properties, which works with both array and model properties! https://t.co/0RtwRPgfld" src="https://pbs.twimg.com/media/EiXw7FcXYAEGzFy.jpg?name=small">
</a>
<a href="https://pbs.twimg.com/media/EiXw7h3WAAEjT9F.jpg?name=large" target="_blank">
<img alt="If you didn&#039;t know, @LaravelLivewire now triggers &quot;updated&quot; and &quot;updating&quot; hooks for nested properties, which works with both array and model properties! https://t.co/0RtwRPgfld" src="https://pbs.twimg.com/media/EiXw7h3WAAEjT9F.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/LiamHammett" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1236048705297485837/oGeWeWid_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Liam Hammett</span>
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/LiamHammett/status/1307716271904096262" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 If you don&#039;t like the &quot;double indentation&quot; of Vue data(), you can use arrow functions</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Edb2vN0XoAEnunt.png?name=large" target="_blank">
<img alt="If you don&#039;t like the &quot;double indentation&quot; of Vue data(), you can use arrow functions" src="https://pbs.twimg.com/media/Edb2vN0XoAEnunt.png?name=small">
</a>
<a href="https://pbs.twimg.com/media/Edb2vO8WoAAAcdX.png?name=large" target="_blank">
<img alt="If you don&#039;t like the &quot;double indentation&quot; of Vue data(), you can use arrow functions" src="https://pbs.twimg.com/media/Edb2vO8WoAAAcdX.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Left: double nesting
Right: arrow function <a href="https://t.co/6vxwuttW4G">https://t.co/6vxwuttW4G</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1285486044561969154" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 If you want to identify teams, workspaces, etc by path, you don&#039;t have to pass the team ID to every route</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidKFFnX0AEEjwr.png?name=large" target="_blank">
<img alt="If you want to identify teams, workspaces, etc by path, you don&#039;t have to pass the team ID to every route" src="https://pbs.twimg.com/media/EidKFFnX0AEEjwr.png?name=small">
</a>
<a href="https://pbs.twimg.com/media/EidKYlkWoAAWkLD.png?name=large" target="_blank">
<img alt="If you want to identify teams, workspaces, etc by path, you don&#039;t have to pass the team ID to every route" src="https://pbs.twimg.com/media/EidKYlkWoAAWkLD.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>In the example below, the value reaches the middleware, where you can do some stuff, and then is REMOVED from the route parameters before being passed to the action. <a href="https://t.co/3TNUnucmz3">https://t.co/3TNUnucmz3</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308096302530600963" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 If you&#039;re debugging your app and you&#039;d like to examine more things - e.g. the stack trace, executed queries, app context, </h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidXEVXXgAofRdr.jpg?name=large" target="_blank">
<img alt="If you&#039;re debugging your app and you&#039;d like to examine more things - e.g. the stack trace, executed queries, app context, " src="https://pbs.twimg.com/media/EidXEVXXgAofRdr.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>You can use ddd() instead of dd().</p>
<p>I tend to forget about this one, but it's super useful. <a href="https://t.co/hjVNOeLTRI">https://t.co/hjVNOeLTRI</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308109980504133633" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Import namespaces instead of using aliases</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean5otqXYAA4QPR.png?name=large" target="_blank">
<img alt="Import namespaces instead of using aliases" src="https://pbs.twimg.com/media/Ean5otqXYAA4QPR.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Sometimes you may have multiple classes with the same name. Rather than importing them with an alias, import the namespaces. <a href="https://t.co/O14vx38oan">https://t.co/O14vx38oan</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826429483495424" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

959
test/tips/index.html Normal file
View file

@ -0,0 +1,959 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<header class="mt-8">
<h1 class="text-5xl w-full">Laravel Code Tips</h1>
<h2 class="mt-6 text-2xl text-gray-700">Make your Laravel code cleaner, faster, and safer.</h2>
<div class="mt-6 text-gray-800 text-lg">
<a class="inline" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-1">·</span>
<a class="inline" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-1">·</span>
<a class="inline" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
</header>
<main class="mx-auto flex justify-between items-center gap-8 w-1/2">
<section role="feed" class="my-8">
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/use-strict-comparison'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/use-strict-comparison">🔥 Use strict comparison</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Use strict comparison" src="https://pbs.twimg.com/media/Ean722QXgAENwmW.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>ALWAYS use strict comparison (=== and !==). If needed, cast things go the correct type before comparing. Better than weird == results</p>
<p>Also consider enabling strict types in your code. This will prevent passing variables of wrong data types to functions <a href="https://t.co/C0is2rghbs">https://t.co/C0is2rghbs</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/if-you-want-to-identify-teams-workspaces-etc-by-path-you-dont-have-to-pass-the-team-id-to-every-route'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/if-you-want-to-identify-teams-workspaces-etc-by-path-you-dont-have-to-pass-the-team-id-to-every-route">🔥 If you want to identify teams, workspaces, etc by path, you don&#039;t have to pass the team ID to every route</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="If you want to identify teams, workspaces, etc by path, you don&#039;t have to pass the team ID to every route" src="https://pbs.twimg.com/media/EidKFFnX0AEEjwr.png?name=small">
<img alt="If you want to identify teams, workspaces, etc by path, you don&#039;t have to pass the team ID to every route" src="https://pbs.twimg.com/media/EidKYlkWoAAWkLD.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>In the example below, the value reaches the middleware, where you can do some stuff, and then is REMOVED from the route parameters before being passed to the action. <a href="https://t.co/3TNUnucmz3">https://t.co/3TNUnucmz3</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/example-checking-a-parent-relationship-for-some-things'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/example-checking-a-parent-relationship-for-some-things">🔥 Example: Checking a parent relationship for some things</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Example: Checking a parent relationship for some things" src="https://pbs.twimg.com/media/EidbX_UWAAMeB6-.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Such as, checking if an Order is locked inside an OrderProduct.</p>
<p>OrderProducts cannot be added to/changed in a locked order. <a href="https://t.co/4v8iIkebPk">https://t.co/4v8iIkebPk</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/create-model-methods-for-business-logic'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/create-model-methods-for-business-logic">🔥 Create model methods for business logic</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Create model methods for business logic" src="https://pbs.twimg.com/media/Ean0WGiWAAAg4cu.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Your controllers should be simple. They should say things like &quot;create invoice for order&quot;. They shouldn't be concerned with the details of how your database is structured.</p>
<p>Leave that to the model. <a href="https://t.co/1w1s2sbwkO">https://t.co/1w1s2sbwkO</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/yesterday-in-my-at-laracononline-talk-i-explained-how-to-use-the-query-builder-when-method-to-handle-complex-sorting'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/yesterday-in-my-at-laracononline-talk-i-explained-how-to-use-the-query-builder-when-method-to-handle-complex-sorting">🔥 Yesterday in my @LaraconOnline talk I explained how to use the query builder when() method to handle complex sorting</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Yesterday in my @LaraconOnline talk I explained how to use the query builder when() method to handle complex sorting" src="https://pbs.twimg.com/media/ERyNRSIX0AEjjWo.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>What you may not realize is that the when() method also accepts a second callback for the falsy case. This is really helpful for setting a sort default. 🤩 <a href="https://t.co/11eni5DW1Z">https://t.co/11eni5DW1Z</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/its-about-the-micro'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/its-about-the-micro">🔥 It&#039;s about the *micro*</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Using some &quot;macro&quot; philosophy for structuring your code, like hexagonal architecture or DDD won't save you.</p>
<p>A clean codebase is the result of constant good decisions at the micro level.</p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/dont-use-a-controller-namespace'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/dont-use-a-controller-namespace">🔥 Don&#039;t use a controller namespace</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Don&#039;t use a controller namespace" src="https://pbs.twimg.com/media/Ean6NFJX0AAfiXT.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Instead of writing controller actions like PostController@index, use the callable array syntax [PostController::class, 'index'].</p>
<p>You will be able to navigate to the class by clicking PostController. <a href="https://t.co/h2UF1te3E3">https://t.co/h2UF1te3E3</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/use-data-transfer-objects-dtos'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/use-data-transfer-objects-dtos">🔥 Use Data Transfer Objects (DTOs)</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Use Data Transfer Objects (DTOs)" src="https://pbs.twimg.com/media/Ean3uMaWAAApBhb.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Rather than passing a huge amount of arguments in a specific order, consider creating an object with properties to store this data.</p>
<p>Bonus points if you can find that some behavior can be moved into to this object. <a href="https://t.co/C1FSrjYWLP">https://t.co/C1FSrjYWLP</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/use-expressive-names-for-methods'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/use-expressive-names-for-methods">🔥 Use expressive names for methods</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Use expressive names for methods" src="https://pbs.twimg.com/media/Ean4xcqWAAUsjdG.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Rather than thinking &quot;what can this object do&quot;, think about &quot;what can be done with this object&quot;. Exceptions apply, such as with action classes, but this is a good rule of thumb.</p>
<p><a href="https://t.co/LScInA8ToE">https://t.co/LScInA8ToE</a> <a href="https://t.co/lLm5SaWk2m">https://t.co/lLm5SaWk2m</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/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'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/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">🔥 There&#039;s 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 PHP/Laravel App state</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="There&#039;s 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 PHP/Laravel App state" src="https://pbs.twimg.com/media/Eic9xP2XsAoo8ay.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>For example, use $model-&gt;is($anotherModel) to check if they refer to the same row. <a href="https://t.co/kBquNQYPgA">https://t.co/kBquNQYPgA</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/consider-using-helpers-instead-of-facades-they-can-clean-things-up'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/consider-using-helpers-instead-of-facades-they-can-clean-things-up">🔥 Consider using helpers instead of facades. They can clean things up</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Consider using helpers instead of facades. They can clean things up" src="https://pbs.twimg.com/media/Ean7QGBXYAEt_l2.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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.</p>
<p>Bonus points for session('key') syntax. <a href="https://t.co/AbMzJl4Puz">https://t.co/AbMzJl4Puz</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/closure-validation-rules-are-theyre-often-better-than-creating-a-class-just-for-a-single-use'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/closure-validation-rules-are-theyre-often-better-than-creating-a-class-just-for-a-single-use">🔥 Closure validation rules are 🔥. They&#039;re often better than creating a class just for a single use</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Closure validation rules are 🔥. They&#039;re often better than creating a class just for a single use" src="https://pbs.twimg.com/media/EidAtSYXgAc-6tH.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Create a class if it's used on multiple places or way too complex. <a href="https://t.co/nslCQb8pDh">https://t.co/nslCQb8pDh</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/use-events'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/use-events">🔥 Use events</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Use events" src="https://pbs.twimg.com/media/Ean07-jXkAErgaL.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Consider offloading some logic from controllers to events. For example, when creating models.</p>
<p>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 <a href="https://t.co/6zJaMPScBk">https://t.co/6zJaMPScBk</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/create-single-use-blade-includes'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/create-single-use-blade-includes">🔥 Create single-use Blade includes</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Similar to single-use traits.</p>
<p>This tactic is great when you have a very long template and you want to make it more manageable.</p>
<p>There's nothing wrong with @including headers and footers in layouts, or things like complex forms in page views.</p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/you-can-return-mailables-as-responses-from-controllers-it-will-show-the-rendered-version-in-the-browser'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/you-can-return-mailables-as-responses-from-controllers-it-will-show-the-rendered-version-in-the-browser">🔥 You can return Mailables as responses from controllers. It will show the rendered version in the browser</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="You can return Mailables as responses from controllers. It will show the rendered version in the browser" src="https://pbs.twimg.com/media/Eic6iydX0AgLupY.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Great for debugging/tweaking the design. <a href="https://t.co/bdB22XLnHz">https://t.co/bdB22XLnHz</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/create-fluent-objects'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/create-fluent-objects">🔥 Create fluent objects</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Create fluent objects" src="https://pbs.twimg.com/media/Ean3zqXWAAASnOP.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>You can also create objects with fluent APIs. Gradually add data by with separate calls, and only require the absolute minimum in the constructor.</p>
<p>Each method will return $this, so you can stop at any call. <a href="https://t.co/826OBHPEAX">https://t.co/826OBHPEAX</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/consider-using-form-requests'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/consider-using-form-requests">🔥 Consider using form requests</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Consider using form requests" src="https://pbs.twimg.com/media/Ean0kWgXgAAcOXm.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>They're a great place to hide complex validation logic.</p>
<p>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 <a href="https://t.co/RwzDxANxXj">https://t.co/RwzDxANxXj</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/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'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/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">🔥 Wanna update a set of Eloquent models and have the change updated in the database and in your in-memory instances, but don&#039;t wanna incur a database query for *each* model?</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Wanna update a set of Eloquent models and have the change updated in the database and in your in-memory instances, but don&#039;t wanna incur a database query for *each* model?" src="https://pbs.twimg.com/media/EWVoC3jVcAEg0JX.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Custom collections got you sorted. Love these methods. <a href="https://t.co/1sehVNNDug">https://t.co/1sehVNNDug</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/instead-of-writing-repetitive-else-if-statements-use-an-array-to-look-up-the-wanted-value-based-on-the-key-you-have'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/instead-of-writing-repetitive-else-if-statements-use-an-array-to-look-up-the-wanted-value-based-on-the-key-you-have">🔥 Instead of writing repetitive `else if` statements, use an array to look up the wanted value based on the key you have</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Instead of writing repetitive `else if` statements, use an array to look up the wanted value based on the key you have" src="https://pbs.twimg.com/media/EanzWiHXsAAhshs.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>The code will be cleaner &amp; more readable and you will see understandable exceptions if something goes wrong. No half-passing edge cases. <a href="https://t.co/zarUdjftUi">https://t.co/zarUdjftUi</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/use-custom-collections'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/use-custom-collections">🔥 Use custom collections</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Use custom collections" src="https://pbs.twimg.com/media/Ean3-8QXYAAmi7V.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Creating custom collections can be a great way to achieve more expressive syntax. Consider this example with order totals. <a href="https://t.co/vFBtUFlR7n">https://t.co/vFBtUFlR7n</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/when-a-relationship-is-already-loaded-and-cached-on-the-model-instance-youll-have-to-refresh-it'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/when-a-relationship-is-already-loaded-and-cached-on-the-model-instance-youll-have-to-refresh-it">🔥 When a relationship is already loaded and &quot;cached&quot; on the model instance, you&#039;ll have to refresh it</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="When a relationship is already loaded and &quot;cached&quot; on the model instance, you&#039;ll have to refresh it" src="https://pbs.twimg.com/media/Eic_JawXgAAEbYL.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p><code>$domain-&amp;gt;refresh();</code> to refresh its attributes</p>
<p><code>$tenant-&amp;gt;load('primary_domain');</code> to update the <code>primary_domain</code> relationship on the $tenant instance <a href="https://t.co/FdzT5rilEr">https://t.co/FdzT5rilEr</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/create-single-use-traits'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/create-single-use-traits">🔥 Create single-use traits</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Create single-use traits" src="https://pbs.twimg.com/media/Ean5BnEWkAEPUTe.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Adding methods to classes where they belong is cleaner than creating action classes for everything, but it can make the classes grow big</p>
<p>Consider using traits. They're meant <em>primarily</em> for code reuse, but there's nothing wrong with single-use traits <a href="https://t.co/dWWLNWuOoS">https://t.co/dWWLNWuOoS</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/people-underutilize-the-exception-handler'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/people-underutilize-the-exception-handler">🔥 People underutilize the exception handler</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="People underutilize the exception handler" src="https://pbs.twimg.com/media/Eic5sfxWAAY2ym2.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>You can tell the app what response to return when a specific exception is encountered.</p>
<p>This is the simplest example. There's many more use cases. <a href="https://t.co/diMoktScI3">https://t.co/diMoktScI3</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/be-friends-with-your-ide'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/be-friends-with-your-ide">🔥 Be friends with your IDE</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Be friends with your IDE" src="https://pbs.twimg.com/media/Ean6t2ZXgAEiJMa.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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. <a href="https://t.co/xNMR2UHed7">https://t.co/xNMR2UHed7</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/laravel-nova-lets-you-show-different-resourcestoolscards-based-on-an-if-check'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/laravel-nova-lets-you-show-different-resourcestoolscards-based-on-an-if-check">🔥 Laravel Nova lets you show different resources/tools/cards/... based on an if check</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Laravel Nova lets you show different resources/tools/cards/... based on an if check" src="https://pbs.twimg.com/media/EidABmBXcAAto9_.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Extremely handy when you have multiple admin panels in a single app. <a href="https://t.co/3HvDb1Ae3N">https://t.co/3HvDb1Ae3N</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/avoid-helper-classes'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/avoid-helper-classes">🔥 Avoid helper *classes*</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Avoid helper *classes*" src="https://pbs.twimg.com/media/Ean2CnyWoAEZ3Ef.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Sometimes people put helpers into a class.</p>
<p>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. <a href="https://t.co/iIcyReIW9N">https://t.co/iIcyReIW9N</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/create-variables-when-they-improve-readability'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/create-variables-when-they-improve-readability">🔥 Create variables when they improve readability</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Create variables when they improve readability" src="https://pbs.twimg.com/media/Ean0HJwWAAAZkDR.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>The opposite of the previous tip. Sometimes the value comes from a complex call and as such, creating a variable improves readability &amp; removes the need for a comment.</p>
<p>Remember that context matters &amp; your end goal is readability <a href="https://t.co/hwFni2X6zA">https://t.co/hwFni2X6zA</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/try-to-avoid-unnecessary-nesting-by-returning-a-value-early'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/try-to-avoid-unnecessary-nesting-by-returning-a-value-early">🔥 Try to avoid unnecessary nesting by returning a value early</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Try to avoid unnecessary nesting by returning a value early" src="https://pbs.twimg.com/media/EanzmPwXYAAoH2A.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Too much nesting &amp; else statements tend to make code harder to read. <a href="https://t.co/PGueS91cgD">https://t.co/PGueS91cgD</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/extract-methods'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/extract-methods">🔥 Extract methods</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Extract methods" src="https://pbs.twimg.com/media/Ean1UORWkAE4UDD.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>If some method is too long or complex, and it's hard to understand what exactly is happening, split the logic into multiple methods. <a href="https://t.co/ljFm6RFk8i">https://t.co/ljFm6RFk8i</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/dont-split-lines-at-random-places-but-dont-make-them-too-long-either'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/dont-split-lines-at-random-places-but-dont-make-them-too-long-either">🔥 Don&#039;t split lines at random places, but don&#039;t make them too long either</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Don&#039;t split lines at random places, but don&#039;t make them too long either" src="https://pbs.twimg.com/media/Eanz0jnXsAAvkv1.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Opening an array with [ and indenting the values tends to work well. Same with long function parameter values.</p>
<p>Other good places to split lines are chained calls and closures. <a href="https://t.co/bnTL2I0Bxa">https://t.co/bnTL2I0Bxa</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/if-you-dont-like-the-double-indentation-of-vue-data-you-can-use-arrow-functions'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/if-you-dont-like-the-double-indentation-of-vue-data-you-can-use-arrow-functions">🔥 If you don&#039;t like the &quot;double indentation&quot; of Vue data(), you can use arrow functions</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="If you don&#039;t like the &quot;double indentation&quot; of Vue data(), you can use arrow functions" src="https://pbs.twimg.com/media/Edb2vN0XoAEnunt.png?name=small">
<img alt="If you don&#039;t like the &quot;double indentation&quot; of Vue data(), you can use arrow functions" src="https://pbs.twimg.com/media/Edb2vO8WoAAAcdX.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Left: double nesting
Right: arrow function <a href="https://t.co/6vxwuttW4G">https://t.co/6vxwuttW4G</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/laravel-telescope-is-great-for-so-many-things'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/laravel-telescope-is-great-for-so-many-things">🔥 Laravel Telescope is great for so many things</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Laravel Telescope is great for so many things" src="https://pbs.twimg.com/media/EidI3vCXgAIOCvY.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>One of them is examining sent emails ✉️</p>
<p>You usually don't need a service like Mailtrap. Just use the <code>log</code> mail driver and install Telescope.</p>
<p>(image stolen from the internet) <a href="https://t.co/odX4ZHzHE3">https://t.co/odX4ZHzHE3</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/have-a-single-source-of-truth-for-validation-rules'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/have-a-single-source-of-truth-for-validation-rules">🔥 Have a single source of truth for validation rules</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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.</p>
<p><a href="https://t.co/qI1Q0HUEyK">https://t.co/qI1Q0HUEyK</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/this-one-is-less-obscure'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/this-one-is-less-obscure">🔥 This one is less obscure</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="This one is less obscure" src="https://pbs.twimg.com/media/EidvI20XcAA7MGY.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>The $loop variable.</p>
<p>It greatly complements Tailwind-styled tables.</p>
<p>Striped tables done easily 🎉 <a href="https://t.co/prm735AEuN">https://t.co/prm735AEuN</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/comparing-changes-on-saving-using'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/comparing-changes-on-saving-using">🔥 Comparing changes on &#039;saving&#039; using:</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Comparing changes on &#039;saving&#039; using:" src="https://pbs.twimg.com/media/EidZs1IWAAUgH0m.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>$model-&gt;getOriginal()</p>
<p>in Eloquent event listeners can be very useful.</p>
<p>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. <a href="https://t.co/rDD1ziOapj">https://t.co/rDD1ziOapj</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/dont-use-model-methods-to-retrieve-data'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/dont-use-model-methods-to-retrieve-data">🔥 Don&#039;t use model methods to retrieve data</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Don&#039;t use model methods to retrieve data" src="https://pbs.twimg.com/media/Ean58GjWAAAgqLq.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>If you want to retrieve some data from a model, create an accessor.</p>
<p>Keep methods for things that <em>change</em> the model in some way. <a href="https://t.co/3IpmbDuNF9">https://t.co/3IpmbDuNF9</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/use-collections-when-they-can-clean-up-your-code'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/use-collections-when-they-can-clean-up-your-code">🔥 Use collections when they can clean up your code</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Use collections when they can clean up your code" src="https://pbs.twimg.com/media/Ean8WekXkAEafMW.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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. <a href="https://t.co/Jd8O3QFrP8">https://t.co/Jd8O3QFrP8</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/use-short-operators'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/use-short-operators">🔥 Use short operators</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Use short operators" src="https://pbs.twimg.com/media/Ean63YeXQAABhBd.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>PHP has many great operators that can replace ugly if checks. Memorize them. <a href="https://t.co/pGLyyNtwpj">https://t.co/pGLyyNtwpj</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/consider-single-action-controllers'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/consider-single-action-controllers">🔥 Consider single-action controllers</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Consider single-action controllers" src="https://pbs.twimg.com/media/Ean6Sn9XkAA-WKS.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>If you have a complex route action, consider moving it to a separate controller.</p>
<p>For OrderController::create, you'd create CreateOrderController.</p>
<p>Another solution is to move that logic to an action class — do what works best in your case. <a href="https://t.co/Rn6lFnhkVH">https://t.co/Rn6lFnhkVH</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/write-functional-code-when-it-benefits-you'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/write-functional-code-when-it-benefits-you">🔥 Write functional code when it benefits you</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Write functional code when it benefits you" src="https://pbs.twimg.com/media/Ean8cQUWoAEjdO3.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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. <a href="https://t.co/1xVD2qwtkw">https://t.co/1xVD2qwtkw</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/use-docblocks-only-when-they-clarify-things'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/use-docblocks-only-when-they-clarify-things">🔥 Use docblocks only when they clarify things</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Use docblocks only when they clarify things" src="https://pbs.twimg.com/media/Ean8DcIXkAESZ_P.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Many people will disagree with this, because they do it. But it makes no sense.</p>
<p>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.</p>
<p>That's just noise. <a href="https://t.co/Q2O6Kp0jzN">https://t.co/Q2O6Kp0jzN</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/create-action-classes'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/create-action-classes">🔥 Create action classes</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Create action classes" src="https://pbs.twimg.com/media/Ean0gvIWsAAIfxK.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Let's expand on the previous example. Sometimes, creating a class for a single action can clean things up.</p>
<p>Models should encapsulate the business logic related to them, but they shouldn't be too big. <a href="https://t.co/Mll37AAh5o">https://t.co/Mll37AAh5o</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/context-matters'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/context-matters">🔥 Context matters</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Context matters" src="https://pbs.twimg.com/media/Ean8vC0WAAEomIq.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Above I said that moving business logic to action/service classes is good. But context matters</p>
<p>Here's code design advice from a popular &quot;Laravel best practices&quot; repo. There's absolutely no reason to put a 3-line check into a class. That's just overengineered <a href="https://t.co/zOtKmaVtMu">https://t.co/zOtKmaVtMu</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/create-helper-functions'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/create-helper-functions">🔥 Create helper functions</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Create helper functions" src="https://pbs.twimg.com/media/Ean1ow4WoAAFjoT.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>If you repeat some code a lot, consider if extracting it to a helper function would make the code cleaner. <a href="https://t.co/2e4TtoVn9N">https://t.co/2e4TtoVn9N</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/if-youre-debugging-your-app-and-youd-like-to-examine-more-things-eg-the-stack-trace-executed-queries-app-context'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/if-youre-debugging-your-app-and-youd-like-to-examine-more-things-eg-the-stack-trace-executed-queries-app-context">🔥 If you&#039;re debugging your app and you&#039;d like to examine more things - e.g. the stack trace, executed queries, app context, </a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="If you&#039;re debugging your app and you&#039;d like to examine more things - e.g. the stack trace, executed queries, app context, " src="https://pbs.twimg.com/media/EidXEVXXgAofRdr.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>You can use ddd() instead of dd().</p>
<p>I tend to forget about this one, but it's super useful. <a href="https://t.co/hjVNOeLTRI">https://t.co/hjVNOeLTRI</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/dont-just-write-procedural-code-in-classes'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/dont-just-write-procedural-code-in-classes">🔥 Don&#039;t just write procedural code in classes</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Don&#039;t just write procedural code in classes" src="https://pbs.twimg.com/media/Ean2u-YX0AEmwEd.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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.</p>
<p>Here's code from my first Laravel project 😬 <a href="https://t.co/2DeGX148Wh">https://t.co/2DeGX148Wh</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/use-custom-config-files'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/use-custom-config-files">🔥 Use custom config files</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Use custom config files" src="https://pbs.twimg.com/media/Ean6FxnXkAAXDsl.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>You can store things like &quot;results per page&quot; 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. <a href="https://t.co/kXkte9Ysrv">https://t.co/kXkte9Ysrv</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/create-query-scopes-for-complex-wheres'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/create-query-scopes-for-complex-wheres">🔥 Create query scopes for complex where()s</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Create query scopes for complex where()s" src="https://pbs.twimg.com/media/Ean5ymtXgAEvlxm.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Rather than writing complex where() clauses, create query scopes with expressive names.</p>
<p>This will make your e.g. controllers have to know less about the database structure and your code will be cleaner. <a href="https://t.co/mqxugYM4oG">https://t.co/mqxugYM4oG</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/dont-create-variables-when-you-can-just-pass-the-value-directly-httpstcos8vozn7aor'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/dont-create-variables-when-you-can-just-pass-the-value-directly-httpstcos8vozn7aor">🔥 Don&#039;t create variables when you can just pass the value directly. https://t.co/S8VOzn7aOr</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Don&#039;t create variables when you can just pass the value directly. https://t.co/S8VOzn7aOr" src="https://pbs.twimg.com/media/Eanz9WJWkAAeoT2.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/dont-use-abbreviations'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/dont-use-abbreviations">🔥 Don&#039;t use abbreviations</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Don&#039;t use abbreviations" src="https://pbs.twimg.com/media/Ean4TBBXgAAMab3.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Don't think that long variable/method names are wrong. They're not. They're expressive.</p>
<p>Better to call a longer method than a short one and check the docblock to understand what it does</p>
<p>Same with variables. Don't use nonsense 3-letters abbreviations <a href="https://t.co/a23I1L7TtW">https://t.co/a23I1L7TtW</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/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'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/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">🔥 When I&#039;m converting data into a different structure, one thing I like to do is annotate how the structure looks at each point of the process</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="When I&#039;m converting data into a different structure, one thing I like to do is annotate how the structure looks at each point of the process" src="https://pbs.twimg.com/media/EinfW11XgAE0y7W.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>I developed this habit when I was building a lot of data conversion scripts in Python, but it's 100% applicable in PHP as well. <a href="https://t.co/fGnbAwoj26">https://t.co/fGnbAwoj26</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/create-custom-blade-directives-for-business-logic'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/create-custom-blade-directives-for-business-logic">🔥 Create custom Blade directives for business logic</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Create custom Blade directives for business logic" src="https://pbs.twimg.com/media/Ean7bYSXkAIwDIR.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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. <a href="https://t.co/FY5CMi4gVP">https://t.co/FY5CMi4gVP</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/you-can-create-dynamic-relationships-this-relationship-is-based-on-a-column-thats-added-using-a-subquery-in-a-scope'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/you-can-create-dynamic-relationships-this-relationship-is-based-on-a-column-thats-added-using-a-subquery-in-a-scope">🔥 You can create dynamic relationships — this relationship is based on a column that&#039;s added using a subquery, in a scope</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="You can create dynamic relationships — this relationship is based on a column that&#039;s added using a subquery, in a scope" src="https://pbs.twimg.com/media/EidrdqwWkAIy4oN.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>And so much more. <a href="https://t.co/EqVABRXKQJ">https://t.co/EqVABRXKQJ</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/this-wont-fit-into-one-tweet-but-theres-so-much-cool-stuff-you-can-do-with-eloquent'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/this-wont-fit-into-one-tweet-but-theres-so-much-cool-stuff-you-can-do-with-eloquent">🔥 This won&#039;t fit into one tweet but there&#039;s so much cool stuff you can do with Eloquent</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="This won&#039;t fit into one tweet but there&#039;s so much cool stuff you can do with Eloquent" src="https://pbs.twimg.com/media/Eidq5A3XsAAM9lA.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>You DON'T have to go raw SQL when you hit a performance issue with Eloquent. There's so many &quot;secret&quot; techniques.</p>
<p>Example: You can create scopes to add specific selects to your queries. <a href="https://t.co/YrIWlKf2K7">https://t.co/YrIWlKf2K7</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/if-you-didnt-know-at-laravellivewire-now-triggers-updated-and-updating-hooks-for-nested-properties-which-works-with-both-array-and-model-properties-httpstco0rtwrpgfld'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/if-you-didnt-know-at-laravellivewire-now-triggers-updated-and-updating-hooks-for-nested-properties-which-works-with-both-array-and-model-properties-httpstco0rtwrpgfld">🔥 If you didn&#039;t know, @LaravelLivewire now triggers &quot;updated&quot; and &quot;updating&quot; hooks for nested properties, which works with both array and model properties! https://t.co/0RtwRPgfld</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="If you didn&#039;t know, @LaravelLivewire now triggers &quot;updated&quot; and &quot;updating&quot; hooks for nested properties, which works with both array and model properties! https://t.co/0RtwRPgfld" src="https://pbs.twimg.com/media/EiXw7FcXYAEGzFy.jpg?name=small">
<img alt="If you didn&#039;t know, @LaravelLivewire now triggers &quot;updated&quot; and &quot;updating&quot; hooks for nested properties, which works with both array and model properties! https://t.co/0RtwRPgfld" src="https://pbs.twimg.com/media/EiXw7h3WAAEjT9F.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/you-can-add-a-tags-method-to-a-job-anything-you-return-from-this-method-will-be-displayed-in-horizon'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/you-can-add-a-tags-method-to-a-job-anything-you-return-from-this-method-will-be-displayed-in-horizon">🔥 You can add a tags() method to a job. Anything you return from this method will be displayed in Horizon</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="You can add a tags() method to a job. Anything you return from this method will be displayed in Horizon" src="https://pbs.twimg.com/media/EidtAYaXkAEjAl-.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Very useful if you want to tag jobs with things like the user/tenant id. <a href="https://t.co/cpg1Zp5BPu">https://t.co/cpg1Zp5BPu</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/example-deleting-associated-files-on-deletion-httpstco4j8uzu0zyy'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/example-deleting-associated-files-on-deletion-httpstco4j8uzu0zyy">🔥 Example: Deleting associated files on deletion. https://t.co/4j8UZU0ZYy</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Example: Deleting associated files on deletion. https://t.co/4j8UZU0ZYy" src="https://pbs.twimg.com/media/EidbEGZXYAA6q3G.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/import-namespaces-instead-of-using-aliases'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/import-namespaces-instead-of-using-aliases">🔥 Import namespaces instead of using aliases</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Import namespaces instead of using aliases" src="https://pbs.twimg.com/media/Ean5otqXYAA4QPR.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Sometimes you may have multiple classes with the same name. Rather than importing them with an alias, import the namespaces. <a href="https://t.co/O14vx38oan">https://t.co/O14vx38oan</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/eloquent-listeners-are-awesome'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/eloquent-listeners-are-awesome">🔥 Eloquent listeners are awesome</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Eloquent listeners are awesome" src="https://pbs.twimg.com/media/EidaLtrXcAU0nIG.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Example: Default value set on creation. <a href="https://t.co/eXVC8WR0xV">https://t.co/eXVC8WR0xV</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/laravel-migrations-have-a-very-nice-syntax-for-foreign-keys'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/laravel-migrations-have-a-very-nice-syntax-for-foreign-keys">🔥 Laravel migrations have a very nice syntax for foreign keys</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>I didn't know about this for so long.</p>
<p>Instead of:
$table-&gt;unsignedBigInteger('user_id');
$table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users');</p>
<p>You do:
$table-&gt;foreignId('user_id')-&gt;constrained();</p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/you-can-use-wherexandy-in-eloquent'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/you-can-use-wherexandy-in-eloquent">🔥 You can use where{X}and{Y}() in Eloquent</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="You can use where{X}and{Y}() in Eloquent" src="https://pbs.twimg.com/media/EidOOuTXYAYMtI9.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Not recommended in most cases, but interesting.</p>
<p>(image stolen from the internet) <a href="https://t.co/8kKmRUYi8e">https://t.co/8kKmRUYi8e</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/relevant-for-people-building-packages'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/relevant-for-people-building-packages">🔥 Relevant for people building packages 📦</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Relevant for people building packages 📦" src="https://pbs.twimg.com/media/EidBy75XsA4CZGx.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>It's IMO better to use static properties and have &quot;self-contained&quot; behavior &amp; configuration. Than to have a billion config keys. Especially when building large packages.</p>
<p>Makes the package more extensible, by consisting of atomic parts <a href="https://t.co/tyucZmkmsz">https://t.co/tyucZmkmsz</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/dedicate-a-weekend-towards-learning-proper-oop'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/dedicate-a-weekend-towards-learning-proper-oop">🔥 Dedicate a weekend towards learning proper OOP</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Know the difference between static/instance methods &amp; variables and private/protected/public visibility. Also learn how Laravel uses magic methods.</p>
<p>You don't need this as a beginner, but as your code grows, it's crucial.</p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/avoid-queries-in-blade-when-possible'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/avoid-queries-in-blade-when-possible">🔥 Avoid queries in Blade when possible</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Avoid queries in Blade when possible" src="https://pbs.twimg.com/media/Ean7jvPWkAAp2_6.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Sometimes you may want to execute DB queries in blade. There are some ok use cases for this, such as in layout files.</p>
<p>But if it's a view returned by a controller, pass the data in the view data instead. <a href="https://t.co/olodRS3N9s">https://t.co/olodRS3N9s</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/you-can-return-false-from-a-ing-eloquent-event-listener-creating-updating-saving-deleting-to-cancel-the-action'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/you-can-return-false-from-a-ing-eloquent-event-listener-creating-updating-saving-deleting-to-cancel-the-action">🔥 You can return &quot;false&quot; from a -ing() Eloquent event listener (creating, updating, saving, deleting) to cancel the action</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="You can return &quot;false&quot; from a -ing() Eloquent event listener (creating, updating, saving, deleting) to cancel the action" src="https://pbs.twimg.com/media/Eidmle3WoAI72Yk.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>This is similar to how I was throwing an exception based on certain things in the example with order locking. <a href="https://t.co/fg5z2TWGZx">https://t.co/fg5z2TWGZx</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/you-can-explicitly-bind-objects-to-routes-you-dont-have-to-use-route-model-binding-only-custom-objects-work-perfectly-well-too'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/you-can-explicitly-bind-objects-to-routes-you-dont-have-to-use-route-model-binding-only-custom-objects-work-perfectly-well-too">🔥 You can explicitly bind objects to routes. You don&#039;t have to use route model binding only. Custom objects work perfectly well too</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="You can explicitly bind objects to routes. You don&#039;t have to use route model binding only. Custom objects work perfectly well too" src="https://pbs.twimg.com/media/EidyDmfWsAI14-C.png?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>This example is from Tenancy v2 when we had an ActiveRecord-style custom Tenant object. <a href="https://t.co/kydWSrcmer">https://t.co/kydWSrcmer</a></p>
</section>
</article>
<article class="border-b-2 border-gray-200 py-16" x-data @click="window.location.href = 'http://127.0.0.1:6969/tips/heres-another-example-of-the-model-state-stuff-mentioned-above'">
<h1 class="text-3xl font-medium">
<a href="http://127.0.0.1:6969/tips/heres-another-example-of-the-model-state-stuff-mentioned-above">🔥 Here&#039;s another example of the Model state stuff mentioned above</a>
</h1>
<div class="mt-4 flex justify-center w-1/2 gap-1 flex-wrap mx-auto">
<img alt="Here&#039;s another example of the Model state stuff mentioned above" src="https://pbs.twimg.com/media/EidDSDcXYAA_7XD.jpg?name=small">
</div>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Except...</p>
<p>It's multi-tenant!</p>
<p>Tip 7: It's incredibly easy to use <a href="https://t.co/XDsbINZGoO">https://t.co/XDsbINZGoO</a> with Tinker 😎 <a href="https://t.co/kyk0A0te2M">https://t.co/kyk0A0te2M</a></p>
</section>
</article>
</section>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Instead of writing repetitive `else if` statements, use an array to look up the wanted value based on the key you have</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EanzWiHXsAAhshs.jpg?name=large" target="_blank">
<img alt="Instead of writing repetitive `else if` statements, use an array to look up the wanted value based on the key you have" src="https://pbs.twimg.com/media/EanzWiHXsAAhshs.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>The code will be cleaner &amp; more readable and you will see understandable exceptions if something goes wrong. No half-passing edge cases. <a href="https://t.co/zarUdjftUi">https://t.co/zarUdjftUi</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822439689555969" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 It&#039;s about the *micro*</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Using some &quot;macro&quot; philosophy for structuring your code, like hexagonal architecture or DDD won't save you.</p>
<p>A clean codebase is the result of constant good decisions at the micro level.</p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822438406094848" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Laravel migrations have a very nice syntax for foreign keys</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>I didn't know about this for so long.</p>
<p>Instead of:
$table-&gt;unsignedBigInteger('user_id');
$table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users');</p>
<p>You do:
$table-&gt;foreignId('user_id')-&gt;constrained();</p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308126491188883463" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Laravel Nova lets you show different resources/tools/cards/... based on an if check</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidABmBXcAAto9_.png?name=large" target="_blank">
<img alt="Laravel Nova lets you show different resources/tools/cards/... based on an if check" src="https://pbs.twimg.com/media/EidABmBXcAAto9_.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Extremely handy when you have multiple admin panels in a single app. <a href="https://t.co/3HvDb1Ae3N">https://t.co/3HvDb1Ae3N</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308084774586773510" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Laravel Telescope is great for so many things</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidI3vCXgAIOCvY.png?name=large" target="_blank">
<img alt="Laravel Telescope is great for so many things" src="https://pbs.twimg.com/media/EidI3vCXgAIOCvY.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>One of them is examining sent emails ✉️</p>
<p>You usually don't need a service like Mailtrap. Just use the <code>log</code> mail driver and install Telescope.</p>
<p>(image stolen from the internet) <a href="https://t.co/odX4ZHzHE3">https://t.co/odX4ZHzHE3</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308094765544734720" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 People underutilize the exception handler</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Eic5sfxWAAY2ym2.png?name=large" target="_blank">
<img alt="People underutilize the exception handler" src="https://pbs.twimg.com/media/Eic5sfxWAAY2ym2.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>You can tell the app what response to return when a specific exception is encountered.</p>
<p>This is the simplest example. There's many more use cases. <a href="https://t.co/diMoktScI3">https://t.co/diMoktScI3</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308082889561604102" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Relevant for people building packages 📦</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidBy75XsA4CZGx.jpg?name=large" target="_blank">
<img alt="Relevant for people building packages 📦" src="https://pbs.twimg.com/media/EidBy75XsA4CZGx.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>It's IMO better to use static properties and have &quot;self-contained&quot; behavior &amp; configuration. Than to have a billion config keys. Especially when building large packages.</p>
<p>Makes the package more extensible, by consisting of atomic parts <a href="https://t.co/tyucZmkmsz">https://t.co/tyucZmkmsz</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308086649184751619" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 There&#039;s 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 PHP/Laravel App state</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Eic9xP2XsAoo8ay.png?name=large" target="_blank">
<img alt="There&#039;s 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 PHP/Laravel App state" src="https://pbs.twimg.com/media/Eic9xP2XsAoo8ay.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>For example, use $model-&gt;is($anotherModel) to check if they refer to the same row. <a href="https://t.co/kBquNQYPgA">https://t.co/kBquNQYPgA</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308082893865005068" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 This one is less obscure</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EidvI20XcAA7MGY.png?name=large" target="_blank">
<img alt="This one is less obscure" src="https://pbs.twimg.com/media/EidvI20XcAA7MGY.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>The $loop variable.</p>
<p>It greatly complements Tailwind-styled tables.</p>
<p>Striped tables done easily 🎉 <a href="https://t.co/prm735AEuN">https://t.co/prm735AEuN</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308136547217281026" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 This won&#039;t fit into one tweet but there&#039;s so much cool stuff you can do with Eloquent</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Eidq5A3XsAAM9lA.png?name=large" target="_blank">
<img alt="This won&#039;t fit into one tweet but there&#039;s so much cool stuff you can do with Eloquent" src="https://pbs.twimg.com/media/Eidq5A3XsAAM9lA.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>You DON'T have to go raw SQL when you hit a performance issue with Eloquent. There's so many &quot;secret&quot; techniques.</p>
<p>Example: You can create scopes to add specific selects to your queries. <a href="https://t.co/YrIWlKf2K7">https://t.co/YrIWlKf2K7</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308134105389953024" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Try to avoid unnecessary nesting by returning a value early</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EanzmPwXYAAoH2A.jpg?name=large" target="_blank">
<img alt="Try to avoid unnecessary nesting by returning a value early" src="https://pbs.twimg.com/media/EanzmPwXYAAoH2A.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Too much nesting &amp; else statements tend to make code harder to read. <a href="https://t.co/PGueS91cgD">https://t.co/PGueS91cgD</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822441392377856" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Use collections when they can clean up your code</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean8WekXkAEafMW.png?name=large" target="_blank">
<img alt="Use collections when they can clean up your code" src="https://pbs.twimg.com/media/Ean8WekXkAEafMW.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>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. <a href="https://t.co/Jd8O3QFrP8">https://t.co/Jd8O3QFrP8</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826458667442176" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Use custom collections</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean3-8QXYAAmi7V.jpg?name=large" target="_blank">
<img alt="Use custom collections" src="https://pbs.twimg.com/media/Ean3-8QXYAAmi7V.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Creating custom collections can be a great way to achieve more expressive syntax. Consider this example with order totals. <a href="https://t.co/vFBtUFlR7n">https://t.co/vFBtUFlR7n</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822470656045057" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Use custom config files</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean6FxnXkAAXDsl.png?name=large" target="_blank">
<img alt="Use custom config files" src="https://pbs.twimg.com/media/Ean6FxnXkAAXDsl.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>You can store things like &quot;results per page&quot; 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. <a href="https://t.co/kXkte9Ysrv">https://t.co/kXkte9Ysrv</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826435254845441" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Use Data Transfer Objects (DTOs)</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean3uMaWAAApBhb.jpg?name=large" target="_blank">
<img alt="Use Data Transfer Objects (DTOs)" src="https://pbs.twimg.com/media/Ean3uMaWAAApBhb.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Rather than passing a huge amount of arguments in a specific order, consider creating an object with properties to store this data.</p>
<p>Bonus points if you can find that some behavior can be moved into to this object. <a href="https://t.co/C1FSrjYWLP">https://t.co/C1FSrjYWLP</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822466528845825" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Use docblocks only when they clarify things</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean8DcIXkAESZ_P.jpg?name=large" target="_blank">
<img alt="Use docblocks only when they clarify things" src="https://pbs.twimg.com/media/Ean8DcIXkAESZ_P.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Many people will disagree with this, because they do it. But it makes no sense.</p>
<p>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.</p>
<p>That's just noise. <a href="https://t.co/Q2O6Kp0jzN">https://t.co/Q2O6Kp0jzN</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826454301163520" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Use events</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean07-jXkAErgaL.jpg?name=large" target="_blank">
<img alt="Use events" src="https://pbs.twimg.com/media/Ean07-jXkAErgaL.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Consider offloading some logic from controllers to events. For example, when creating models.</p>
<p>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 <a href="https://t.co/6zJaMPScBk">https://t.co/6zJaMPScBk</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822453753036801" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Use expressive names for methods</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean4xcqWAAUsjdG.png?name=large" target="_blank">
<img alt="Use expressive names for methods" src="https://pbs.twimg.com/media/Ean4xcqWAAUsjdG.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Rather than thinking &quot;what can this object do&quot;, think about &quot;what can be done with this object&quot;. Exceptions apply, such as with action classes, but this is a good rule of thumb.</p>
<p><a href="https://t.co/LScInA8ToE">https://t.co/LScInA8ToE</a> <a href="https://t.co/lLm5SaWk2m">https://t.co/lLm5SaWk2m</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272822475957645312" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,86 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Use short operators</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean63YeXQAABhBd.jpg?name=large" target="_blank">
<img alt="Use short operators" src="https://pbs.twimg.com/media/Ean63YeXQAABhBd.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>PHP has many great operators that can replace ugly if checks. Memorize them. <a href="https://t.co/pGLyyNtwpj">https://t.co/pGLyyNtwpj</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826443630817281" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Use strict comparison</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Ean722QXgAENwmW.jpg?name=large" target="_blank">
<img alt="Use strict comparison" src="https://pbs.twimg.com/media/Ean722QXgAENwmW.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>ALWAYS use strict comparison (=== and !==). If needed, cast things go the correct type before comparing. Better than weird == results</p>
<p>Also consider enabling strict types in your code. This will prevent passing variables of wrong data types to functions <a href="https://t.co/C0is2rghbs">https://t.co/C0is2rghbs</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/laravel-clean-code-tactics">
Laravel Clean Code Tactics
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1272826452652810240" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 Wanna update a set of Eloquent models and have the change updated in the database and in your in-memory instances, but don&#039;t wanna incur a database query for *each* model?</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EWVoC3jVcAEg0JX.jpg?name=large" target="_blank">
<img alt="Wanna update a set of Eloquent models and have the change updated in the database and in your in-memory instances, but don&#039;t wanna incur a database query for *each* model?" src="https://pbs.twimg.com/media/EWVoC3jVcAEg0JX.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>Custom collections got you sorted. Love these methods. <a href="https://t.co/1sehVNNDug">https://t.co/1sehVNNDug</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/timacdonald87" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1249274319059841024/-8bpTPMC_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Tim MacDonald</span>
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/timacdonald87/status/1253524892055560193" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 When a relationship is already loaded and &quot;cached&quot; on the model instance, you&#039;ll have to refresh it</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/Eic_JawXgAAEbYL.png?name=large" target="_blank">
<img alt="When a relationship is already loaded and &quot;cached&quot; on the model instance, you&#039;ll have to refresh it" src="https://pbs.twimg.com/media/Eic_JawXgAAEbYL.png?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p><code>$domain-&amp;gt;refresh();</code> to refresh its attributes</p>
<p><code>$tenant-&amp;gt;load('primary_domain');</code> to update the <code>primary_domain</code> relationship on the $tenant instance <a href="https://t.co/FdzT5rilEr">https://t.co/FdzT5rilEr</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Thread</dt>
<dd class="text-left text-blue-800">
<a href="http://127.0.0.1:6969/threads/1-rt-1-tip">
1 RT = 1 tip
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308084124947820554" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

View file

@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<link rel="stylesheet" href="/css/app.css?id=d5acc62a4ce7a6842556">
<script type="module" src="/js/app.js?id=a136d2a5a73d65f4c129"></script>
<link href="https://fonts.rcvd.io/iA%20Writer/stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body class="antialiased bg-white">
<div class="w-full p-3 text-center min-h-screen flex justify-between flex-col">
<main class="mx-auto flex justify-between items-center gap-8">
<aside class="flex flex-col gap-2">
<h2 class="text-2xl font-medium">
<a class="block" href="/">
Laravel Code Tips
</a>
</h2>
<div class="flex justify-between">
<a class="block" href="https://twitter.com/LaravelCodeTips" target="_blank">
<span class="link">Twitter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://newsletter.laravel-code.tips" target="_blank">
<span class="link">Newsletter</span>
</a>
<span class="px-2">·</span>
<a class="block" href="https://t.me/laraveltips" target="_blank">
<span class="link">Telegram</span>
</a>
</div>
<a class="block" href="/">
<span class="link">All tips</span>
</a>
</aside>
<article class="max-w-5xl w-full mt-8 text-xl">
<header class="flex justify-center flex-wrap gap-5">
<h1 class="text-4xl w-full">🔥 When I&#039;m converting data into a different structure, one thing I like to do is annotate how the structure looks at each point of the process</h1>
<div class="flex justify-center w-1/2 gap-1 flex-wrap">
<a href="https://pbs.twimg.com/media/EinfW11XgAE0y7W.jpg?name=large" target="_blank">
<img alt="When I&#039;m converting data into a different structure, one thing I like to do is annotate how the structure looks at each point of the process" src="https://pbs.twimg.com/media/EinfW11XgAE0y7W.jpg?name=small">
</a>
</div>
</header>
<section role="article" class="mt-8 text-xl prose mx-auto">
<p>I developed this habit when I was building a lot of data conversion scripts in Python, but it's 100% applicable in PHP as well. <a href="https://t.co/fGnbAwoj26">https://t.co/fGnbAwoj26</a></p>
</section>
</article>
<aside>
<dl class="grid grid-cols-2 gap-x-5 gap-y-4 items-center">
<dt class="text-right">Author</dt>
<dd class="text-left">
<a href="https://twitter.com/samuelstancl" class="flex items-center gap-2" target="_blank">
<img src="https://pbs.twimg.com/profile_images/1257272213088190464/8kuysprf_normal.jpg" class="w-8 rounded-full border-blue-800 border-2">
<span class="text-blue-800">Samuel Štancl</span>
</a>
</dd>
<dt class="text-right">Tweet</dt>
<dd class="text-left text-blue-800">
<a href="https://twitter.com/samuelstancl/status/1308823625194233867" target="_blank">
twitter.com/...
</a>
</dd>
</dl>
</aside>
</main>
<footer class="space-y-2 text-gray-700 text-sm">
<p>Found an error? Contact us at <a href="mailto:hello@laravel-code.tips" class="link">support@laravel-code.tips</a>.</p>
<p>Want to share a tip? Submit it <a href="https://airtable.com/shrBX2ZAfnuAXh3up" target="_blank" class="link">here</a>.</p>
</footer>
</div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show more