Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration problems #37

Open
nejccc opened this issue Mar 13, 2019 · 0 comments
Open

Migration problems #37

nejccc opened this issue Mar 13, 2019 · 0 comments

Comments

@nejccc
Copy link

nejccc commented Mar 13, 2019

Quick fix solution

<?php

namespace App\Middlewares;

use App\Facades\Api;
use Firebase\JWT\JWT;
use Silver\Core\Blueprints\MiddlewareInterface;
use Silver\Core\Env;
use Silver\Http\Request;
use Silver\Http\Response;
use Closure;
use Silver\Http\Session;
use Silver\Http\Redirect;
class Migration implements MiddlewareInterface
{
    // put the name to make it public
    private $unguard = [
        'unguard',
    ];
    public function execute(Request $req, Response $res, Closure $next)
    {
        if ($req->route() == null) {
            return $next();
        }
        if (!array_search($req->route()->middleware(), $this->unguard) !== false) {
if(ENV::get('local') == 'local')
return $next();
            //Change here if you want to check if someone is loggin in owherwise use Error 404;
            return \Silver\Http\View::error('404');
        }
        return $next();
    }
}```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant