Questions tagged [ardent]

Ardent is a package that provides self-validating smart models for the Laravel framework's Eloquent O/RM.

Ardent provides self-validating smart models for Laravel Framework 4's Eloquent O/RM, based on the Aware bundle for Laravel 3. With it, Laravel validation rules can be inserted into the model's class as a tag variable. At save, the model will validate itself and modify the database or in faliure it gives error messages.

Installation

Add laravelbook/ardent as a requirement to composer.json:

{
    "require": {
        "laravelbook/ardent": "dev-master"
    }
}

Update the packages with composer update or install with composer install.

Useful links

57 questions
6
votes
1 answer

How to use Sentry with Ardent in Laravel?

In my models I use Ardent for self-validating but I have a model where I also need to use Sentry for authentication. So I need to extend Ardent and Sentry too, but I can't because there is no multiple inheritance in PHP. I tried to do it with…
totymedli
  • 29,531
  • 22
  • 131
  • 165
4
votes
1 answer

firstorcreate is not working for new entry laravel

I am new to laravel and using ardent for creating models, I have below base class for all model. class MainModel extends Ardent { //with some common methods } and now i have sub model class such user class User extends MainModel { //with user…
user-666
  • 45
  • 6
4
votes
2 answers

Laravel/Ardent/User model editing + saving

what is the intended way to edit a user model with password in laravel/ardent? My problem is, that I do not want to load the actual user model from the db before the user input is validated correctly. Validation obviously fails when I leave the…
Eike Cochu
  • 3,249
  • 7
  • 34
  • 57
3
votes
6 answers

Laravel 4 - Ardent - The password confirmation does not match

So I am working on an implementation of Ardent in Laravel 4 and I can't seem to sort out why this password confirmation just won't match. My user controller looks likes this: use Illuminate\Auth\UserInterface; use…
Jason Brodie
  • 330
  • 5
  • 13
3
votes
1 answer

TDD with Laravel 4, Factory Muff, Ardent, Faker - I'm doing it wrong

I want to write tests for my data models that make sense and work I've been playing trying to test models like a boss in Laravel (right now I'd say I'm struggling to hold down a position in middle management). I'm using Ardent for my data models.…
Ben Harold
  • 6,242
  • 6
  • 47
  • 71
2
votes
1 answer

Optional Ardent Requirement

I'm using Ardent with Laravel. We are working on a site that only allows US customers but we're extending it to Canadian customers as well. One of our requirements is that the zip code be 5-9 characters long, all numbers (we strip out the dash and…
StackOverflowed
  • 5,854
  • 9
  • 55
  • 119
2
votes
0 answers

Validate two models in Laravel 4.2

I have a form that represents two instances of a same Address class (let's say main address and billing address), which in turn inherits from Ardent. The form is defined as: Form::model($data, ...) where: $data = [ 'mainAddress' => [instance A of…
Cranio
  • 9,647
  • 4
  • 35
  • 55
2
votes
1 answer

Call to a member function has() on array when calling @if ($errors->has()) in blade

I'm trying to return the errors from a form in a blade template using Ardent. This is the function I'm using in my controller: public function store() { $subscriber = new Subscriber; $subscriber->first_name = Input::get('first_name'); …
Daniel Doyle
  • 39
  • 1
  • 8
2
votes
0 answers

Laravelbook/Ardent ignoring autoHydrateEntityFromInput value

I have $autoHydrateEntityFromInput = true and $forceEntityHydrationFromInput = false because I want the input elements not in the model rules to be dropped during hydration. If they aren't dropped, there is a "column not found" error for the model…
eComEvo
  • 11,669
  • 26
  • 89
  • 145
2
votes
1 answer

Laravel Ardent not saving model when using updateUniques()

I'm doing user editing facility for my admin panel. I'm using updateUniques() in my code, as recommended by Ardent when having 'unique' rules in the model. When I do it, it passes with no problem, but model hasn't changed. My code: $user =…
Cysioland
  • 1,126
  • 1
  • 9
  • 21
2
votes
1 answer

Ardent model does not validate after save

I'm having problems inserting objects in a one to many relationship. This is my code: /** * Migrations **/ // Create user__groups table Schema::create('user__groups', function (Blueprint $table) { $table->increments('id'); …
Øystein Amundsen
  • 3,993
  • 8
  • 44
  • 63
2
votes
1 answer

Is it necessary to test relationships in both directions?

I'm attempting to test relationships between models using Ardent and FactoryMuff. I'm able to test the relationship in the belongs_to direction, but I'm having trouble testing it in the has_many direction. The models I'm testing are a residential…
Ben Harold
  • 6,242
  • 6
  • 47
  • 71
2
votes
1 answer

Creating a custom validation rule in Ardent w/ Laravel that can access the model to do dirty checking

Goal I have an Ardent model called User in Laravel. I want to have a custom validation rule called confirm_if_dirty. This would only run if the User->password attribute is dirty. It would expect there to be a User->password_confirmation field. Below…
Mark Evans
  • 810
  • 10
  • 18
1
vote
1 answer

Laravel 5.5. using authentication and Ardent

I'm having trouble using Ardent package with Laravel authentication. The problem is that in order to use Laravel authentication I have to extend my User model with Authenticatable (use Illuminate\Foundation\Auth\User as Authenticatable;) But in…
Norgul
  • 4,613
  • 13
  • 61
  • 144
1
vote
1 answer

Laravel saving hasMany relationship

I'm using Laravel & Ardent and having issues saving through the hasMany relationship. I have two classes. Workorder: protected $table = 'workorder'; protected $primaryKey = 'workorder_id'; public static $relationsData = [ …
Matt Brunmeier
  • 1,310
  • 2
  • 11
  • 22
1
2 3 4