Download the PHP package reinbier/laravel-unique-with without Composer

On this page you can find all versions of the php package reinbier/laravel-unique-with. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-unique-with

Unique With Validator rule for Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package contains a variant of the validateUnique rule for Laravel, that allows for validation of multi-column UNIQUE indexes.

Please note

This package is to continue development of the package uniquewith-validator by Felix Kiss and have it work with recent versions of the Laravel framework (continuing from Laravel 9 onwards). For older versions of the framework, please use the aforementioned package.

Installation

You can install the package via composer:

Usage

Use it like any Validator rule:

See the Validation documentation of Laravel.

Specify different column names in the database

If your input field names are different from the corresponding database columns, you can specify the column names explicitly.

e.g. your input contains a field 'last_name', but the column in your database is called 'sur_name':

Ignore existing row (useful when updating)

You can also specify a row id to ignore (useful to solve unique constraint when updating)

This will ignore row with id 2

To specify a custom column name for the id, pass it like

If your id is not numeric, you can tell the validator

Add additional clauses (e.g. when using soft deletes)

You can also set additional clauses. For example, if your model uses soft deleting then you can use the following code to select all existing rows but marked as deleted

Soft delete caveat:

If the validation is performed in a form request class, field deleted_at is skipped, because it's not send in request. To solve this problem, add 'deleted_at' => null to your validation parameters in request class., e.g.:

Specify specific database connection to use

If we have a connection named some-database, we can enforce this connection (rather than the default) like this:

Example

Pretend you have a users table in your database plus User model like this:

Now you can validate a given first_name, last_name combination with something like this:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

The code from this package is based on the original code that came from uniquewith-validator by Felix Kiss.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-unique-with with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
spatie/laravel-package-tools Version ^1.14.0
illuminate/contracts Version ^9.0|^10.0|^11.0
illuminate/support Version ^9.0|^10.0|^11.0
illuminate/validation Version ^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package reinbier/laravel-unique-with contains the following files

Loading the files please wait ....