mhulse / slim-php-boiler

So I can get up-and-running with Slim quickly.
Apache License 2.0
2 stars 0 forks source link

Fix if not found #4

Open mhulse opened 7 years ago

mhulse commented 7 years ago

return $this->check() ? User::find($_SESSION['user']) : '';

https://github.com/mhulse/slim-php-boiler/blob/d404dff8d1870d37e85e632c627a05e1d924aa7b/app/Auth/Auth.php#L12

mhulse commented 7 years ago
public function check() {

    return isset($_SESSION['user']);

}
mhulse commented 7 years ago

Need to do this for all, like:

        # Quick patch to avoid NOTICE:
        if (isset($_SESSION['errors'])) {

            $this->container->view->getEnvironment()->addGlobal('errors', $_SESSION['errors']); // Now a global inside of views.
            unset($_SESSION['errors']); // This is important!

        }
mhulse commented 7 years ago

Make utility class for this kind of thing.