<?php
interface NewCache{
public function output();
}
class Cache1 implements NewCache{
public function output()
{
echo "cache1 output";
}
}
class Cache2 implements NewCache{
public function output()
{
echo "cache2 output";
}
}
class Foo {
private $cache;
public function __construct(NewCache $cache)
{
$this->cache = $cache;
}
public function fun()
{
return $this->cache->output();
}
}
Artisan::command('test', function () {
app()->bind('NewCache','Cache1');
app()->bind('foo','Foo');
app('foo')->fun();
})->describe('test');