Support the ongoing development of Laravel.io →
Validation Architecture

Hi, I implemented validation as service, as it is described in this book https://leanpub.com/implementinglaravel

I have problem validating like this.

use Libraries\Services\Validation\Signup\User; use Libraries\Services\Validation\Signup\Charity; use Libraries\Repositories\User\UserInterface; use Libraries\Repositories\Charity\CharityInterface;

class SignupController extends BaseController {

public function __construct(UserInterface $user, User $validatorUser, CharityInterface $charity, Charity $validatorCharity) {
	$this->validatorUser = $validatorUser;
	$this->user = $user;
	$this->validatorCharity = $validatorCharity;
	$this->charity = $charity;
}


public function charity() {
	if ($this->validatorCharity->with(Input::all())->passes() and $this->validatorUser->with(Input::all())->passes()) {

	} else {
		return Response::json(array('type' => 'validation-fail', 'errors' => $this->validatorUser->errors()), 500);
	}
}

}

What I am doing wrong?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

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.