Laravel is not working

Today I use the container for laravel services. I know that there is a lot to find on the Internet about this, but I cannot find a solution for this. I am trying to associate an interface with a class, but when I do this, I get an error message:

Target [App \ Contracts \ UploadService] does not work.

This is my service container called UploadServiceContainer:

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;


class UploadServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind('App\Contracts\UploadService', 'App\Classes\upload\upload');
    }

}

I am trying to create it in the same way in the controller:

public function storeTicket(makeTicketRequest $request,UploadService $upload)
{ }

I registered my Serviceprovider in app.php. And I also did:

php artisan clear-compiled
+4
source share
1 answer

bind() App\Contracts\UploadService ( "" ), App\Contracts\UploadService ( "" ). .

+2

Source: https://habr.com/ru/post/1623669/


All Articles