PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Written By
Views

Laravel "doesnt_start_with" rule

Laravel "doesnt_start_with" rule

Did you know that Laravel has an undocumented validation rule?

As opposed to "starts_with" there is a "doesnt_start_with". Just add the translation key to validation.php and you are good to go.

'starts_with' => 'The :attribute must start with one of the following: :values.',
'doesnt_start_with' => 'The :attribute must not start with: :values.',

Example use

SomeInput::make('Swedish phone')
    ->rules([
        'starts_with:+46'
    ])
SomeInput::make('International phone')
    ->rules([
        'doesnt_start_with:+46'
    ])

Comments (0)

loading comments