php - Laravel - Service Provider : Class not found -


i started project on laravel 5.4 today , got serviceprovider problem. here service provider :

<?php  namespace app\providers;  use illuminate\support\serviceprovider;  class wizamprovider extends serviceprovider {     /**      * bootstrap application services.      *      * @return void      */     public function boot()     {         //die('yesss');     }      /**      * register application services.      *      * @return void      */     public function register()     {       $this->app->bind('wizam\test', function()       {         if(class_exists("domains\domomat\test"))           return new \domains\domomat\test;         else           return new \core\classes\test;       });     } } 

i added provider config/app.php (app\providers\wizamprovider::class), dump autoloader twenty times, clear cache, clear config. nothing happened.

here route :

route::get('/sub', function() {   $test = new \wizam\test();   echo $test->render(); }); 

when go '/sub', got class 'wizam\test' not found. cannot see error, can me ?

thanks !

to use container cannot instantiate using new command, can either inject through constructor

__constructor(\wizam\test $test) { } 

or using app(\wizam\test::class) believe other way mentioned in comments.


Comments