Skip to content

Instantly share code, notes, and snippets.

@bennettblack
bennettblack / ArrayableEnum.php
Created January 22, 2024 14:07
Arrayable Enum
<?php
namespace App\Concerns;
trait ArrayableEnum
{
/**
* Array represntation of a backed enum, keyed by values.
*/
public static function toArray(): array
@bennettblack
bennettblack / RedisService.php
Created August 24, 2023 01:21
Get all Redis keys in a connection
<?php
namespace App\Services;
use Illuminate\Support\Facades\Redis;
class RedisService
{
public static function getValues(string $connection)
{
@bennettblack
bennettblack / LoadCventRegistrants.php
Created October 5, 2022 11:46
RicorocksDigitalAgency SOAP Example
<?php
namespace App\Console\Commands\Misc;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use RicorocksDigitalAgency\Soap\Facades\Soap;
/**
| |
@bennettblack
bennettblack / StringService.php
Created March 18, 2022 19:53
String Service
<?php
namespace App\Services;
class StringService
{
/**
* Find ALL strings that are between two strings. Optionally include delimiters.
*/
function strBetweenAll(string $string, string $start, string $end, bool $includeDelimiters = false, int &$offset = 0): ?array
@bennettblack
bennettblack / ApplyMailHeader.php
Created May 21, 2021 13:08
Listener, that applies header to outgoing emails
<?php
namespace App\Listeners;
use Illuminate\Mail\Events\MessageSending;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class ApplyMailHeader
{
@bennettblack
bennettblack / stored_procedure.php
Last active July 12, 2022 21:47
DB2 for IBM i Series stored procedure call (Laravel)
<?php
use Illuminate\Support\Facades\DB;
use PDO;
class ClassName {
public static function methodName(String $customer, String $item_number){
$input_param = 'blah';
@bennettblack
bennettblack / frosted_glass.css
Created May 10, 2021 20:33
Tailwind frosted glass effect
<div class="backdrop-filter backdrop-blur-3xl backdrop-saturate-150 bg-black bg-opacity-40 rounded-2xl">
<!-- Content -->
</div>
@bennettblack
bennettblack / raw_email.php
Last active April 25, 2021 16:32
Laravel Raw Email (no view)
<?php
Mail::raw("This is the email's text. ", function($message){
$message->to('bennett@bscx.us')
->subject('Email via Callback');
});