Skip to content

Instantly share code, notes, and snippets.

View Gummibeer's full-sized avatar
🐼
beary busy

Tom Herrmann Gummibeer

🐼
beary busy
View GitHub Profile
<?php
namespace Hospitable\Avalara\Casts;
use Carbon\CarbonInterface;
use DateTimeZone;
use Spatie\LaravelData\Casts\DateTimeInterfaceCast;
use Spatie\LaravelData\Casts\Uncastable;
use Spatie\LaravelData\Exceptions\CannotCastDate;
use Spatie\LaravelData\Support\DataProperty;
<?php
namespace Tests\Asserts;
use App\Enums\DeliveryStatus;
use App\Enums\DistributionRoundStatus;
use App\Enums\DistributionStopType;
use App\Enums\DistributionTaskStatus;
use App\Enums\PackingStationType;
use App\Enums\ProductStockEventReason;
<?php
namespace App\Nova;
use App\Nova\Fields\DateTime;
use Carbon\CarbonImmutable;
use Cron\CronExpression;
use Illuminate\Http\Request;
use Laravel\Nova\Fields\Boolean;
use Laravel\Nova\Fields\Text;
<?php
Repository::macro('swr', function (string $key, DateInterval|DateTimeInterface|int $tts, DateInterval|DateTimeInterface|int $ttl, Closure $callback): mixed {
/** @var Repository $this */
if ($this->getSeconds($tts) >= $this->getSeconds($ttl)) {
throw new UnexpectedValueException('The time-to-stale value must be less than the time-to-live value.');
}
$ttsKey = "{$key}:tts";
$revalidatingKey = "{$key}:revalidating";
<?php
namespace App\Geotools\Data;
use App\Geotools\Casts\GeographyCast;
use App\Geotools\Contracts\GeoJsonable;
use App\Geotools\Contracts\WellKnownTextable;
use App\Geotools\GeoJson\GeoJson;
use App\Geotools\GeoJson\Point;
use App\Geotools\Value\WktString;
<?php
class CreateTenantRequest extends Formrequest
{
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
'settings' => ['required', 'array', 'contrains:timezone,currency'],
];