MCMatters/laravel-helpers

View on GitHub
src/Macros/RequestMacros.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

declare(strict_types=1);

namespace McMatters\Helpers\Macros;

use Illuminate\Http\Request;
use Illuminate\Support\Str;

use function in_array;

use const true;

class RequestMacros extends AbstractMacroable
{
    protected function registerIsUpdateMethod(): void
    {
        Request::macro('isUpdateMethod', function (): bool {
            return in_array(Str::lower($this->method()), ['put', 'patch'], true);
        });
    }
}