ardent

Ardent + Laravel, auto hydrate relation

早过忘川 提交于 2019-12-23 04:08:37
问题 I use lavarel with ardent package. I have some problem when i want to update a row. I have 2 model Client and Address related by morphone relation. This relation work well, when i want to get a client this line return expected result : Client::with('address')->find($id); But i can't understand how to update a client with a clean solution. Somebody can answer to these questions : With Ardent how could you autoHydrate related model ? When you update some data, what is the best practice in

Confide custom validator

半世苍凉 提交于 2019-12-12 06:55:44
问题 I am using confide for user authentication. I wanna use custom rules using laravel's Validator (for firstname and lastname) class as in $validator = Validator::make($user, $this->rules[$ruleset]); and check with $validator->passes() . How can I achieve this? 回答1: First create your custom validation class. Something like this: class CustomValidator { /** * @return bool */ public function validateFirstname($attribute, $value, $parameters) { { // Do here your Firstname validation ... } /** *

Laravel/Ardent/User model editing + saving

删除回忆录丶 提交于 2019-12-09 13:30:28
问题 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 password field empty, because a password is required. This is my current post-edit-action: public function postEdit($id) { // ardent autohydrates this model $newUser = new User; // validation fails if(!$newUser->validate()) return Redirect::action(