assume that data storage drivers can be switched through the configuration file, such as storing the data in mysql, and then changing the configuration file to redis.
currently my pseudo code is as follows:
1: create an interface
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->app->bind("App\Repositories\Interfaces\CategoryInterface",
"App\Repositories\Implement\CategoryMysqlRepository");
}
}
how to change the binding mode to achieve the above purpose. Thank you.