dru
2 weeks ago
135
4
Laravel

Custom helper not working correctly

Posted 2 weeks ago by dru

I'm making a custom helper, so I created a file in App\Helpers\imagenCorporativa.php

then I registered in a new service provider called FuncionesServiceProvider

and in there I put in register:

public function register()
{
    //
    require_once app_path() . '/Helpers/imagenCorporativa.php';
}

Then in config\app.php

I added the provider:

App\Providers\FuncionesServiceProvider::class,

and finally the ALIAS:

 'Funciones' => App\Helpers\imagenCorporativa::class,

But I don't understand Why does it work when I test it in the routes and not in the controller.

the error that gives me is: Class 'App\Http\Controllers\Funciones' not found

Please sign in or create an account to participate in this conversation.