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
| # ttfb — quick TTFB checks for multiple paths on one host. Paste-ready output. | |
| # | |
| # Install: add to ~/.zshrc (or source this file), then run: source ~/.zshrc | |
| # Usage: ttfb example.com /up /products /about | |
| # Auth: TTFB_AUTH='user:pass' ttfb example.com / | |
| # | |
| # Defaults to https:// and tests / when no paths are given. | |
| # Colors: status (2xx green, 3xx yellow, 4xx/5xx red), TTFB (<300ms green, <800ms yellow, slower red) | |
| ttfb() { |
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
| <?php | |
| namespace App\Providers; | |
| use Illuminate\Support\ServiceProvider; | |
| use Laravel\Scout\Builder; | |
| class MacroServiceProvider extends ServiceProvider | |
| { | |
| /** |
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
| <?php | |
| namespace App\Providers; | |
| class DuskServiceProvider extends ServiceProvider | |
| { | |
| /** | |
| * The classes that should be mocked for Dusk tests | |
| * | |
| * @var array |
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
| <?php | |
| namespace App\Filters; | |
| use Closure; | |
| use Illuminate\Pipeline\Pipeline; | |
| use Throwable; | |
| class PipelineFilter extends Pipeline | |
| { |
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
| public function scopeBySaleType($query, type) | |
| { | |
| $query->whereHas('sales', function ($query) use ($type) { | |
| $query->where('id', function ($sub) { | |
| $sub->from('sales') | |
| ->selectRaw('max(id)') | |
| ->whereColumn('sales.inventory_id', 'inventories.id'); | |
| })->where('type', $type); | |
| }); | |
| } |
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
| if(! class_exists(\LodeApp\PHPUnit\Console::class)) { | |
| function console($vars, $dump = true) { | |
| dump($vars); | |
| } | |
| } |
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
| <?php | |
| namespace App\Traits; | |
| trait LockColumns | |
| { | |
| /** | |
| * Cast locked_columns as a JSON column | |
| * | |
| * @return void |
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
| <?php | |
| namespace App\Http\Middleware; | |
| use Closure; | |
| class CorsHeaders | |
| { | |
| /** | |
| * Handle an incoming request. |
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
| <?php | |
| namespace App\Engines; | |
| use Illuminate\Support\Collection; | |
| use Laravel\Scout\Engines\AlgoliaEngine; | |
| class AdvancedAlgoliaEngine extends AlgoliaEngine | |
| { |
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
| public static function testRename() | |
| { | |
| self::batchRename('s3', 'documents', function ($file) { | |
| return str_replace('%20', '-', $file); | |
| }); | |
| } | |
| public static function batchRename($disk, $directory, $callback) | |
| { | |
| $disk = \Illuminate\Support\Facades\Storage::disk($disk); |
NewerOlder