PHPackages                             ankitsinghdalal/laravel-unique-on-multiple - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. ankitsinghdalal/laravel-unique-on-multiple

ActiveValidator[Validation &amp; Sanitization](/categories/validation)

ankitsinghdalal/laravel-unique-on-multiple
==========================================

This package would serve the purpose of unique validator against multiple columns

1.0.0(4y ago)16MITPHPPHP &gt;=5.6

Since Sep 16Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ankitsinghdalal/LaravelUniqueOnMultiple)[ Packagist](https://packagist.org/packages/ankitsinghdalal/laravel-unique-on-multiple)[ Docs](https://github.com/ankitsinghdalal/LaravelUniqueOnMultiple)[ RSS](/packages/ankitsinghdalal-laravel-unique-on-multiple/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require ankitsinghdalal/laravel-unique-on-multiple
```

The package will automatically register itself.

Usage
-----

[](#usage)

Inside **app/Http/Requests/Something/StoreSometing.php**

```
/**
 * Get the validation rules that apply to the request.
 *
 * @return array
 */
public function rules()
{
    return [
        'name' => 'required|max:225|uniqueOfMultiple:menus,location_id-' . $this->get('location_id', 'NULL') . ',language_id-' . $this->get('language_id', 1),
        'location_id' => 'required|exists:menu_location,id',
        'order' => 'digits_between:0,10'
    ];
}
```

Inside **app/Http/Requests/Something/UpdateSomething.php**

```
/**
 * Get the validation rules that apply to the request.
 *
 * @return array
 */
public function rules()
{
    return [
        'name' => 'required|max:225|uniqueOfMultiple:menus,location_id-' . $this->get('location_id', 'NULL') . ',language_id-' . $this->get('language_id', 'NULL') . ',except-id-' . $this->route('id', 'NULL'),
        'location_id' => 'required|exists:menu_location,id',
        'order' => 'digits_between:0,10'
    ];
}
```

Inside **resources/lang/en/validation.php**

```
'unique_of_multiple' => 'The :attribute has already been taken under its parent.',
```

In the above written piece of code, the custom validation used is `uniqueOfMultiple`. The first argument passed is the table\_name i.e `menus` and all other arguments are column\_name(s) that are comma-separated. The columns used while creating the resoource are ` name (primary column)`, `location_id`, and `language_id`. However updating a resource uses one extra `except-for` condition i.e `except-id`. The respective value passed for each field is `-` separated.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1700d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e61daa35caf460193bc4503cfd4cc31781f4ba78965ea5b755f6cf2c04ae0be3?d=identicon)[ankitsinghdalal](/maintainers/ankitsinghdalal)

---

Top Contributors

[![ankitsinghdalal](https://avatars.githubusercontent.com/u/23275798?v=4)](https://github.com/ankitsinghdalal "ankitsinghdalal (6 commits)")

---

Tags

laravelvalidatormultipleunique

### Embed Badge

![Health badge](/badges/ankitsinghdalal-laravel-unique-on-multiple/health.svg)

```
[![Health](https://phpackages.com/badges/ankitsinghdalal-laravel-unique-on-multiple/health.svg)](https://phpackages.com/packages/ankitsinghdalal-laravel-unique-on-multiple)
```

###  Alternatives

[illuminatech/validation-composite

Allows uniting several validation rules into a single one for easy re-usage

184485.5k](/packages/illuminatech-validation-composite)[stuyam/laravel-phone-validator

A phone validator for Laravel using the free Twilio phone lookup service.

2861.3k](/packages/stuyam-laravel-phone-validator)[laravel-validation-rules/us-state

Validate US States and Canada Provinces

16172.7k](/packages/laravel-validation-rules-us-state)[laravel-validation-rules/timezone

Validate that a given timezone is valid.

2119.0k](/packages/laravel-validation-rules-timezone)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
