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
{
public function boot()
{
}
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
Jamie source
share