Slim3 + eloquent observe + redis

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

$container['laravel-container'] = function ($c){
    return new \Illuminate\Container\Container;
$container['database-event-dispatcher'] = function ($c) {
    return new \Illuminate\Events\Dispatcher($c['laravel-container']);


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

Line: 933
Message: Unresolvable dependency resolving [Parameter #0 [ $container ]] in class Dappur\Model\Observers\RoomUserObserver

where could i make a mistake?
thank you.

Maybe you should give the dependency resolver the information what he has to resolve. For example add Container $container to the constructor (instead of mixed):

use Illuminate\Container\Container;
// ...
public function __construct(Container $container) {

1 Like

I have already done so) did not help)
The second day I can not understand why it does not work.)))

if anyone is interested in how I solved the problem.

class RoomObserver {

    static $container = null;

    public function __construct($container = null) {
			self::$container = $container;			
    public function saved(Room $room) {