php - Constructor is not called in RegisterUser trait: Laravel 5.2 -


i have constructor in trait registersusers. can find trait in below mentioned path

vendor\laravel\framework\src\illuminate\foundation\auth\registersusers.php 

here problem is, constructor not being called...below code.

private function __construct( \app\caching\cachecollection $cachedata ) {     $this->cachecollection = $cachedata;  } 

did faced similar issue before ?

if class useing trait has constructor, constructor provided trait not used. override precedence class methods override trait methods override inherited methods (class > trait > base). if have constructor in class, need remove it.


a few other notes:

first, if @ possible, don't want modify files in vendor directory. changes make in there erased next time composer update, , won't able deploy changes unless you're committing vendor directory repository (not idea). should make new trait usees trait, , includes additional constructor. in classes, use new trait, not registersusers trait.

second, you've declared constructor private. if this, able create new instances of class within class (such static method creates new instances). don't know if intentional or not, letting know.


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -