---- RepositoriesServiseProvider.php---
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use App\Repositories\Contracts\BoardRepository;
use App\Repositories\EloquentBoardRepository;
class RepositoriesServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->bind(BoardRepository::class, EloquentBoardRepository::class);
// $this->app->bind(NoteRepository::class, EloquentNoteRepository::class);
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [
BoardRepository::class,
// NoteRepository::class,
];
}
}
----- Конструктор в Контроллере ---
public function __construct(BoardRepository $boardRepository)
{
dd($boardRepository);
//$this->boardsRepository = $boardsRepository;
}