Example of Form requests in realodix/urlhub

File app/Http/Requests/StoreUrl.php (link to Github)
use App\Rules\StrAlphaUnderscore;
use App\Rules\URL\DomainBlacklist;
use Illuminate\Foundation\Http\FormRequest;

class StoreUrl extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
            'long_url'   => ['required', 'url', 'max:65535', new DomainBlacklist],
            'custom_key' => ['nullable', 'max:20', new StrAlphaUnderscore, 'unique:urls,keyword'],
        ];
    }

    public function messages()
    {
        return [
            'long_url.required' => __('Must be filled, should not be empty.'),
            'long_url.url'      => __('Incorrect link format. The link must begin "http://" or "https://".'),
            'custom_key.max'    => __('The custom url may not be greater than :max characters.'),
            'custom_key.unique' => __(':input has already been taken'),
        ];
    }
}

Additional resources on Form requests: