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 | |
| use Illuminate\Database\Eloquent\Builder; | |
| Builder::macro('toSqlWithBindings', function () { | |
| $bindings = array_map( | |
| fn ($value) => is_numeric($value) ? $value : "'{$value}'", | |
| $this->getBindings() | |
| ); |
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 | |
| // Register these inside a service provider: | |
| Blade::directive('route', function ($expression) { | |
| return "<?php echo route({$expression}) ?>"; | |
| }); | |
| Blade::directive('routeIs', function ($expression) { | |
| return "<?php if (request()->routeIs({$expression})) : ?>"; |
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
| # Run `artisan make:test` for all Controllers under `your app/Http/Controllers` folder. | |
| # Created tests mirror their path under the `app` folder and are suffixed with "Test". | |
| find app/Http/Controllers -type f -name '*Controller.php' -exec sh -c 'php artisan make:test $(dirname "${1:4}")/$(basename "$1" .php)Test' sh {} \; |
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
| trait CreatesWithLock | |
| { | |
| public static function updateOrCreate(array $attributes, array $values = []) | |
| { | |
| return static::advisoryLock(function () use ($attributes, $values) { | |
| // emulate the code found in Illuminate\Database\Eloquent\Builder | |
| return (new static)->newQuery()->updateOrCreate($attributes, $values); | |
| }); | |
| } |
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 | |
| Response::macro('multiFormat', function ($data, $html = '') { | |
| if (request('format') == 'json') { | |
| return $this->json($data); | |
| } | |
| if (request('format') == 'xml') { | |
| if (!is_array($data) && !$data instanceof Arrayable) { /* 400 Bad 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\Providers; | |
| use Illuminate\Http\Request; | |
| use Illuminate\Routing\Route; | |
| use Illuminate\Support\ServiceProvider; | |
| use App\Http\Middleware\CaptureRequestExtension; | |
| class AppServiceProvider 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\Abilities; | |
| use Illuminate\Support\Str; | |
| use ReflectionClass; | |
| /** | |
| * Note: This is a preview of an upcoming package from Tighten. | |
| **/ |
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
| // Creates a new promise that automatically resolves after some timeout: | |
| Promise.delay = function (time) { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(resolve, time) | |
| }) | |
| } | |
| // Throttle this promise to resolve no faster than the specified time: | |
| Promise.prototype.takeAtLeast = function (time) { | |
| return new Promise((resolve, reject) => { |
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 Deployer; | |
| require 'recipe/laravel.php'; | |
| require 'vendor/deployer/recipes/local.php'; | |
| require 'vendor/deployer/recipes/rsync.php'; | |
| require 'vendor/deployer/recipes/npm.php'; | |
| // Configuration | |
| set('ssh_type', 'native'); |
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 // Simple PHP script to lookup for blacklisted IP against multiple DNSBLs at once. ?> | |
| <html> | |
| <head> | |
| <title>DNSBL Lookup Tool - IP Blacklist Check Script</title> | |
| </head> | |
| <body> | |
| <h2>IP Blacklist Check Script</h2> | |
| <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post"> | |
| <input type="text" value="" name="ip"/> | |
| <input type="submit" value="LOOKUP"/> |
NewerOlder