Last active
May 4, 2017 11:24
-
-
Save devmsh/edb41e36260e671baad466f4bf30d93c to your computer and use it in GitHub Desktop.
check auth without middleware
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CustomerController extends Controller{ | |
public function __construct() | |
{ | |
if(!$this->session->get('user_id')){ | |
$this->redirect("/login"); | |
} | |
} | |
} | |
class InvoiceController extends Controller{ | |
public function __construct() | |
{ | |
if(!$this->session->get('user_id')){ | |
$this->redirect("/login"); | |
} | |
if($this->session->get('role') != "Manager"){ | |
$this->redirect("/login"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment