/** * register the provider */ public function register() { $session = new SessionManager(Config::get('stroge.session'), App::make('crypt')); $session->extend('cookie', function (array $configs = []) { $lifetime = Arr::get($configs, 'cookie.lifetime', 1800); $cookie = App::make('cookie'); return new CookieSessionHandler($cookie, $lifetime); }); $session->extend('database', function (array $configs = []) { $table = Arr::get($configs, 'database.table'); $base = App::make('database.base'); return new DatabaseSessionHandler($base, $table); }); $session->extend('file', function (array $configs = []) { $filesystem = Stroge::disk('local'); $path = Arr::get($configs, 'file.path', RESOURCE . 'sessions/'); return new FileSessionHandler($filesystem, $path); }); $session->extend('cache', function () { return App::make('cache'); }); $this->singleton('session', function () use($session) { return $session; }); $this->singleton('session.stroge', function () { $driver = Config::get('stroge.session.driver'); return App::make('session')->driver($driver); }); }
/** * return the value * * @param array $target * @param string|array $keys * @param callable|null $default */ function data_get($target = [], $keys = '', $default = null) { if (is_object($target)) { $target = (array) $target; } if (is_array($keys)) { $keys = join(',', $keys); } Arr::get($target, $keys, $default); }
/** * @param string $name verinin ismi * @param string $value değeri * @return $this */ public function set($name, $value = '') { Arr::set(static::$cache, $name, $value); return $this; }