Hello. Help me please…
i want setup event in model for redis cache update when data save
i use native slim3 container but for observe i use Illuminate\Container\Container
becouse i have problem like this https://stackoverflow.com/questions/51506326/is-it-possible-to-use-php-di-definitions-instead-of-eloquents-capsule-managers-b
$container['laravel-container'] = function ($c){
return new \Illuminate\Container\Container;
};
$container['database-event-dispatcher'] = function ($c) {
return new \Illuminate\Events\Dispatcher($c['laravel-container']);
};
$capsule->setEventDispatcher($container['database-event-dispatcher'])
next
Dappur\Model\RoomUser::observe(new Dappur\Model\Observers\RoomUserObserver($container));
namespace Dappur\Model\Observers;
use Dappur\Model\RoomUser;
use Interop\Container\ContainerInterface;
use Illuminate\Container\Container;
use Symfony\Component\Cache\Adapter\RedisAdapter;
class RoomUserObserver {
public $container;
public function __construct($container) {
$this->container= $container;
}
public function saved(RoomUser $roomUser) {
}
}
and i have error
/var/www/roombear/data/www/roombear.ru/vendor/illuminate/container/Container.php
Line: 933
Message: Unresolvable dependency resolving [Parameter #0 [ $container ]] in class Dappur\Model\Observers\RoomUserObserver
where could i make a mistake?
thank you.