This file contains 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 | |
Builder::macro('whereLike', function ($attributes, string $searchTerm) { | |
$this->where(function (Builder $query) use ($attributes, $searchTerm) { | |
foreach (Arr::wrap($attributes) as $attribute) { | |
$query->when( | |
str_contains($attribute, '.'), | |
function (Builder $query) use ($attribute, $searchTerm) { | |
$relations = explode('.', $attribute); | |
$is_top_level_relationship = true; |
This file contains 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 | |
/** | |
* Adds a static `values` method that returns an array | |
* containing the values of a backed enum | |
*/ | |
trait ListableEnumValues | |
{ | |
static function values(): array | |
{ |
This file contains 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 | |
trait EnumerableConstants | |
{ | |
static function values() | |
{ | |
return array_values ( | |
(new \ReflectionClass(static::class))->getConstants() | |
); | |
} |
This file contains 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
function hash(string) { | |
const utf8 = new TextEncoder().encode(string); | |
return crypto.subtle.digest('SHA-256', utf8).then((hashBuffer) => { | |
const hashArray = Array.from(new Uint8Array(hashBuffer)); | |
const hashHex = hashArray | |
.map((bytes) => bytes.toString(16).padStart(2, '0')) | |
.join(''); | |
return hashHex; | |
}); | |
} |
This file contains 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
# Location of xdebug extension (will probably differ on your own system) | |
zend_extension=/usr/local/lib/php/pecl/20220829/xdebug.so | |
# Enable Xdebug | |
xdebug.mode=debug | |
xdebug.remote_port=9003 | |
xdebug.start_with_request=true | |
xdebug.remote_enable=On | |
xdebug.discover_client_host=true | |
xdebug.remote_connect_back=On |