Support the ongoing development of Laravel.io →
Database Eloquent Packages

Do you use Eloquent in your apps? It's simply fun to work with, right?

I think the same, but after spending some time with it I can tell you, you you can do even better!

Here's eloquence - honey for you models :)

It's set of independent, pluggable extensions that you can easily add to your model. Either one of them or even all - they will work as you need:

Validable - self-validation, just save()
Metable - fully featured meta attributes
Mutable - clean and easy set/get mutators
Mappable - map your relations like a boss

By the way - have you been using Ardent? It's not maintained anymore, you're having problems to make it compatible with your L5 installation or other packages? Struggle no more - just use Eloquence.

Now get it, try it and I'd love all your feedback.

Have fun!

Last updated 3 years ago.
0

Looks nice. When I did something similar (with no intention to make reusable though) I found I sometimes needed 4 validation rule sets (input on create/update and database data on create/update). A simplified example could be User and Password. Input data are 'login', 'password' and 'password confirmation' with rules for passwords however for database data you have got 'login' and 'password_hash'. Same for update.

Last updated 10 years ago.
0

@neomerx Things like password confirmation are applicable basically only during http request, when you're submitting a form, so there's no problem to do something like this:

// Form Request
public function rules()
{
   return array_merge(
        User::getCreateRules(), 
        ['password' => 'confirmed']
   );
}
0

Sure. However when you have all your rules in models and then you have to have some of them outside (e.g. in forms) you start thinking what you should do with it. So did I ;) Anyway you did a big job on coverage and fixing pesky scrutinizer issues :) Keep going, man

0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.