Support the ongoing development of Laravel.io →
Forms Validation

Hi All,

I am working on a package, trying to inject "Illuminate\Validation\Factory" to __construct:

namespace Extensions\Tpp\Forms;


use Illuminate\Validation\Validator as ValidatorInstance;
use Illuminate\Validation\Factory as Validator;

abstract class FormValidator {

	/**
	 * @var Validator
	 */
	protected $validator;

	/**
	 * @var ValidatorInstance
	 */
	protected $validation;

	function __construct(Validator $validator)
	{
		$this->validator = $validator;
	}

But I got an error: Target [Symfony\Component\Translation\TranslatorInterface] is not instantiable.

Searching from the internet, I got this answer:

App::bind('Symfony\Component\Translation\TranslatorInterface', function($app) {
   return $app['translator']; 
});

from http://stackoverflow.com/questions/20142020/php-laravel-cant-initiate-extend-of-abstract-class

Just wondering whether Laravel should do it for us already?

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

liamqma liamqma Joined 9 Apr 2014

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.