Looking to hire Laravel developers? Try LaraJobs

laravel-slug-rule maintained by seeds-std

Description
Slug rule
Author
Last update
2020/01/24 01:49 (dev-master)
License
Links
Downloads
6

Comments
comments powered by Disqus

Slug validation rules for Laravel

Build Status codecov Scrutinizer Code Quality

To check whether the slug is valid format with Str::slug().

Installation

composer require seeds-std/laravel-slug-rule

Usage

Validator::make(['slug' => 'laravel-5-framework'], ['name' => new \SeedsStd\SlugValidation\Slug()])
    ->passes(); // true

Options

  • separator
Validator::make(['slug' => 'laravel_5_framework'], ['name' => new \SeedsStd\SlugValidation\Slug(['separator' => '_'])])
    ->passes(); // true

Translation

Translate validation messages with resources/lang/ja/validation.php

<?php

return [
    'slug' => ':attributeは有効なスラッグを指定してください。',
];