Skip to content

Instantly share code, notes, and snippets.

@johnRivs
Last active April 23, 2025 14:32
Show Gist options
  • Save johnRivs/b324ca653b138417c7916e0e049ca9b2 to your computer and use it in GitHub Desktop.
Save johnRivs/b324ca653b138417c7916e0e049ca9b2 to your computer and use it in GitHub Desktop.
Laravel stuff for every project
Model::unguard();
RequestException::dontTruncate();
Date::use(CarbonImmutable::class);
Vite::prefetch(concurrency: 3);
Model::automaticallyEagerLoadRelationships(); // how does this play with Model::preventLazyLoading();?
Url::forceHttps($this->app->isProduction());
if (! $this->app->isProduction()) {
Model::preventLazyLoading();
DB::enableQueryLog();
DB:whenQueryingForLongerThan(300, function($connection) {
Log::warning('Long running queries detected.', $connection->getQuerylog());
});
} else {
DB::prohibitDestructiveCommands();
}
tests
without vite
without exception handling
laravel debugbar
log viewer https://github.com/opcodesio/log-viewer
telescope locally
https://laracasts.com/series/build-shopify-apps-with-laravel/episodes/7
https://laracasts.com/series/learn-telescope
https://github.com/tnylea/php-ext
vite-image-processor-plugin
build: {
rollupOptions: {
output: {
manualChunks(path) {
if (path.includes('node_modules')) return 'vendor';
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment