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?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community