🤦♂️
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 | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
class ValidateTwilioEventWebhook | |
{ |
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
$sql = "SELECT tblSU.Site, | |
tlkpSUDesc.ESR_SUcat, | |
tlkpSUDesc.ESR_SUcatdisp, | |
tlkpSUDesc.SUDesc, | |
tlkpSUTyp.SUTyp, | |
tblSU.SUNum | |
FROM tlkpSUTyp | |
RIGHT JOIN (tlkpSUDesc RIGHT JOIN tblSU ON tlkpSUDesc.SUDescCode = tblSU.SUDescCode) | |
ON tlkpSUTyp.SUTypCode = tblSU.SUTypCode | |
WHERE tblSU.Site = :id |
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
/** | |
* @credit Luke Waite | |
* @see https://lukewaite.ca/posts/2017/08/17/bash-oneliner-laravel-retry-todays-failed-jobs.html | |
* | |
* See the explanation in Luke's post for the following Bash one liner to retry | |
* a failed queue job for a specific date. The only difference in this version | |
* is {print $2} needs to be {print $3} because the output of queue:failed has | |
* changed. Works for Laravel 9. | |
* | |
* Running the following line will retry all failed jobs from 8/8/2022. |
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
/** Add to your \App\Providers\AppServiceProvider.php or php artisan make:provider MacroServiceProvider | |
* and register your new provider in config/app.php | |
*/ | |
public function register() | |
{ | |
\Illuminate\Database\Eloquent\Builder::macro('whereBetweenDates', function (string $column, array $values) { | |
[$start, $end] = $values; | |
return $this->getQuery() |
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 | |
namespace App\Providers; | |
use Illuminate\Database\Eloquent\Builder; | |
use Illuminate\Support\Facades\DB; | |
use Illuminate\Support\ServiceProvider; | |
class MacroServiceProvider extends ServiceProvider | |
{ |
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 | |
namespace Tests\Unit; | |
use Tests\TestCase; | |
class CarbonNextMonthEndOfMonthTest extends TestCase | |
{ | |
public function setUp(): void | |
{ |
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
'regex:/^[0-9]{5}(?:-[0-9]{4})?$/' |
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 | |
/** | |
* Basic structure for retrying when an exception is thrown in a try/catch block. | |
* This example fails through three retries simply to illustrate the behavior. | |
*/ | |
$retries = 3; | |
for ($try = 0; $try < $retries; $try++) { | |
try { |
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 | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
use Twilio\Rest\Client; | |
class TwilioServiceProvider extends ServiceProvider | |
{ | |
public function register() |
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 | |
use libphonenumber\NumberParseException; | |
use libphonenumber\PhoneNumberToTimeZonesMapper; | |
use libphonenumber\PhoneNumberUtil; | |
if (!function_exists('phone_to_timezone')) { | |
/** | |
* Returns a timezone for a phone number. Note, multiple timezones are | |
* possible for non-US regions. Only the first timezone is returned. |
NewerOlder