php - Laravel does not load subfolder from /app/models -
i'm trying arrange things in app, created folder called "validators" in "/app/models" directory maintain custom validation rules there. expected auto-loaded, it's not. here's code of validator:
class authvalidator extends \illuminate\validation\validator { public function validateactive($input, $value, $parameters) { if ( $input === "email" ) { homecoming user::where("email", $value)->first()->confirmed(); } else { homecoming true; } } } validator::resolver(function($translator, $data, $rules, $messages) { $messages['active'] = "you need confirm email first"; homecoming new authvalidator($translator, $data, $rules, $messages); });
it works fine, if set in /app/models/user.php file, problem not in class definition.
i tried create separated "/app/validators" directory , set composer.json , /app/start/global.php files autoloading. still doesn't load, though did "artisan dump-autoload" , "composer dump-autoload" both.
every time seek utilize custom rule "active", laravel says "method [validateactive] not exist.".
i tried write "echo '123'; exit;" in origin of file , didn't work, file not loaded.
it's weird, because other custom models loaded.
upd: utilize standard files construction , right composer.json not edited.
php laravel
No comments:
Post a Comment