PHPackages                             padosoft/laravel-validable - 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. padosoft/laravel-validable

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

padosoft/laravel-validable
==========================

Trait to activate validation when saving Eloquent Model

1.7.0(1y ago)712.9k↓45%1[2 PRs](https://github.com/padosoft/laravel-validable/pulls)MITPHPPHP &gt;=7.0.0

Since May 16Pushed 9mo ago2 watchersCompare

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

READMEChangelog (3)Dependencies (7)Versions (25)Used By (0)

Trait to activate validation when saving Eloquent Model
=======================================================

[](#trait-to-activate-validation-when-saving-eloquent-model)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e202235db7861e0bf7073a64bf47609ef9d0a44391d7b34ba339ed512b8cfb36/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061646f736f66742f6c61726176656c2d76616c696461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/padosoft/laravel-validable)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![CircleCI](https://camo.githubusercontent.com/6cd95ebc43ec145604a4eca93ebae3f23e098d40bd0957b512cf07ca822ba6bd/68747470733a2f2f636972636c6563692e636f6d2f67682f7061646f736f66742f6c61726176656c2d76616c696461626c652f747265652f6d61737465722e7376673f7374796c653d737667)](https://circleci.com/gh/padosoft/laravel-validable/tree/master)[![Quality Score](https://camo.githubusercontent.com/02f59fc10de5a7cceb7231a70642bfd9bde2caec4308d029d47899b3f5cdd785/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7061646f736f66742f6c61726176656c2d76616c696461626c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/padosoft/laravel-validable)[![Total Downloads](https://camo.githubusercontent.com/e576869d0a78cb98cb0315f991ce195c9f3c7575083d3d92d986be23d29b9c7a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7061646f736f66742f6c61726176656c2d76616c696461626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/padosoft/laravel-validable)

This package provides a trait that will automatic handlind upload when saving/updating/deleting any Eloquent model with upload form request.

\##Requires

- php: &gt;=7.0.0
- illuminate/database: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/support: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0
- illuminate/validation: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0

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

[](#installation)

You can install the package via composer:

```
$ composer require padosoft/laravel-validable
```

Usage
-----

[](#usage)

Your Eloquent models should use the `Padosoft\Laravel\Validable\Validable` trait.

You must define `protected static $rules` array of rules in your model. You can define `protected static $messages` array of custom messages in your model.

Here's an example of how to implement the trait;

```
