PHPackages                             mvanduijker/laravel-model-exists-rule - 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. [Database &amp; ORM](/categories/database)
4. /
5. mvanduijker/laravel-model-exists-rule

ActiveLibrary[Database &amp; ORM](/categories/database)

mvanduijker/laravel-model-exists-rule
=====================================

Validation rule to check if a model exists

3.4.0(2mo ago)22194.5k↓18.4%21MITPHPPHP ^7.3|^8.0CI passing

Since May 19Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/mvanduijker/laravel-model-exists-rule)[ Packagist](https://packagist.org/packages/mvanduijker/laravel-model-exists-rule)[ Docs](https://github.com/mvanduijker/laravel-model-exists-rule)[ RSS](/packages/mvanduijker-laravel-model-exists-rule/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (24)Used By (1)

Laravel Model Exists Rule
=========================

[](#laravel-model-exists-rule)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b44b95d41d11ce7424781e441b95d6d98d1661424325d7f84ad7baa32ed8fd2c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d76616e6475696a6b65722f6c61726176656c2d6d6f64656c2d6578697374732d72756c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mvanduijker/laravel-model-exists-rule)[![Build Status](https://github.com/mvanduijker/laravel-model-exists-rule/workflows/Run%20tests/badge.svg)](https://github.com/mvanduijker/laravel-model-exists-rule/workflows/Run%20tests/badge.svg)[![Total Downloads](https://camo.githubusercontent.com/f993562053550ae9aad0fd3cc72aa9d1cf4a1a2b7d01c1c8af1bdb66cc1ffe93/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d76616e6475696a6b65722f6c61726176656c2d6d6f64656c2d6578697374732d72756c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mvanduijker/laravel-model-exists-rule)

Laravel validation rule to check if a model exists.

You want to use this rule if the standard laravel `Rule::exists('table', 'column')` is not powerful enough. When you want to add joins to your exist rule, or the advanced Eloquent\\Builder features like whereHas this might be for you.

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

[](#installation)

You can install the package via composer:

```
composer require mvanduijker/laravel-model-exists-rule
```

Usage
-----

[](#usage)

Simple

```
