faithfulman
4 months ago
1115
1
Lumen

Lumen - Error on ResponseServiceProvider (ResponseFactory)

Posted 4 months ago by faithfulman

I am trying to add a ResponseFactory to my new ResponseServiceProvider. Though I cannot seem to get it to work. Here is my code:

//in the app.php

$app->register(App\Providers\ResponseServiceProvider::class);

//ResponseServiceProvider.php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Contracts\Routing\ResponseFactory;

class ResponseServiceProvider extends ServiceProvider
{
    // /**
    //  * Bootstrap the application services.
    //  *
    //  * @return void

    public function boot(ResponseFactory $response)
    {
        $response->macro('caps', function ($value) {
            //
        });
    }



    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {

    }
}

I get this error:

Target [Illuminate\Contracts\Routing\ResponseFactory] is not instantiable. on line 958 in file C:\MyProject\vendor\illuminate\container\Container.php"

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