This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$posts = Cache::remember('index.posts', 30, function(){ | |
return Post::with('comments', 'tags', 'author', 'seo')->whereHidden(0)->get(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lazy Loading N+1 Query | |
$books = App\Book::all(); | |
foreach ($books as $book) { | |
echo $book->author->name; | |
} | |
// select * from books | |
// select * from authors where id = 1 | |
// select * from authors where id = N |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## EXPIRES HEADER CACHING ## | |
<IfModule mod_expires.c> | |
# Fonts | |
# Add correct content-type for fonts | |
AddType application/vnd.ms-fontobject .eot | |
AddType application/x-font-ttf .ttf | |
AddType application/x-font-opentype .otf | |
AddType application/x-font-woff .woff | |
AddType image/svg+xml .svg | |
ExpiresActive On |