New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

spajz/modval

Simple model validation for Laravel 4.
12 1

Larablocks Analysis

spajz/modval works with Laravel 4 (latest release 1, Mar 25, 2014), which reached end of life: no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 4, past end of life
  • No release in the last 12 months (last: Mar 25, 2014)
  • 0 downloads a month (needs 10,000)
  • 1 GitHub star (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Mar 25, 2014.
  • No releases in the last 12 months.
  • First released: Mar 25, 2014.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 25, 2026.

Install
composer require spajz/modval
Latest Version:1
PHP:>=5.3.0
Laravel:4
License:MIT
Last Updated:Jun 10, 2015
Links: GitHub  ·  Packagist
Maintainer: spajz

Simple model validation for Laravel 4


  • Auto validate model on save.
  • Use simple or separate rules for model events (create, update and save).
  • Based on Jeffrey Way project Laravel Model Validation.

Installation

Just place require new package for your Laravel installation via composer.json

"spajz/modval": "dev-master"

Then composer update.

You can add following lines to app/config/app.php if you want to use alias:

'Modval' => 'Spajz\Modval\Modval'

Usage

Your models need to extend Modval or Spajz\Modval\Modval.

class Foo extends Modval {

}

How to add rules in the model (same for all events).

class Foo extends Modval {
    protected static $rules = array(
        'title' => 'required',
        'slug' => 'required|min:5',
    );
}

Add rules separately for each event (create, update or save). Save event is executed in both cases (create and update).

class Foo extends Modval {
    protected static $rules = array(
        'create' => array(
            'slug' => 'required|min:5',
        ),
        'update' => array(
            'url' => 'required',
        ),
        'save' => array(
            'title' => 'required',
        ),
    );
}

And here's an example from controller.

public function store()
{
    $foo = new Foo(Input::all());

    if ($foo->save()) return Redirect::route('foo.index');

    return Redirect::back()->withInput()->withErrors($foo->getErrors());
}

Thanks

Thanks to Jeffrey Way and his project Laravel Model Validation:

https://github.com/JeffreyWay/Laravel-Model-Validation

Related Packages

theriddleofenigma/laravel-model-validation

Effortless, self-contained validation for your Eloquent models.

15,095 33
korridor/laravel-model-validation-rules

A laravel validation rule that uses eloquent to validate if a model exists

295,954 29
wendelladriel/laravel-lift

Take your Eloquent Models to the next level

65,617 701
innoscience/eloquental

A rather clever model for Laravel's Eloquent ORM with self-validation, ordering,...

384 3
jenssegers/model

An Laravel eloquent-like model class, for Laravel and other frameworks

4,802,186 393

Version History

Version Released PHP Laravel License
1 >=5.3.0 4.1.* MIT