- https://speakerdeck.com/willroth/50-laravel-tricks-in-50-minutes
- https://www.reddit.com/r/laravel/comments/3to60i/50_laravel_tricks/
- 1. Automatic Model Validation
| cask_args appdir: "/Applications" | |
| tap "homebrew/bundle" | |
| tap "homebrew/cask" | |
| tap "homebrew/cask-drivers" | |
| tap "homebrew/cask-fonts" | |
| tap "homebrew/core" | |
| brew "fish" | |
| brew "git" | |
| brew "httpie" | |
| brew "github/gh/gh" |
| Blade::extend(function ($view) { | |
| return preg_replace( | |
| '/{{(\'|")(.*)(\'|")}}/', | |
| '<?php echo e(trans($1$2$1)); ?>', | |
| $view | |
| ); | |
| }); | |
| // And you should be able to do tho this on your Blade templates |
| var elixir = require('laravel-elixir'); | |
| var gutil = require('gulp-util'); | |
| // If 'gulp watch' is run | |
| if (gutil.env._.indexOf('watch') > -1) { | |
| // Enable watchify for faster builds | |
| elixir.config.js.browserify.watchify.enabled = true |
| // Remember to add tabindex to <a> | |
| body.no-js { | |
| a.dropdown-toggle:focus { | |
| pointer-events: none; | |
| } | |
| a.dropdown-toggle:focus + .dropdown-menu { | |
| opacity: 1; | |
| visibility: visible; | |
| pointer-events: auto; | |
| } |
| <?php | |
| namespace App\Http\Middleware; | |
| use Closure; | |
| use Illuminate\Http\Request; | |
| use Illuminate\Http\Response; | |
| use Symfony\Component\DomCrawler\Crawler; | |
| class PjaxMiddleware |
Other people's projects:
My projects (tutorials are on my blog at http://maxoffsky.com):
| <?php | |
| use Illuminate\Console\Command; | |
| use Symfony\Component\Console\Input\InputOption; | |
| use Symfony\Component\Console\Input\InputArgument; | |
| class ImageOptimize extends Command { | |
| /** | |
| * The console command name. |
| #301 Redirects for .htaccess | |
| #Redirect a single page: | |
| Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
| #Redirect an entire site: | |
| Redirect 301 / http://www.domain.com/ | |
| #Redirect an entire site to a sub folder | |
| Redirect 301 / http://www.domain.com/subfolder/ |