Login ready
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 19/12/2017
|
||||
* Time: 16:52
|
||||
*/
|
||||
|
||||
class CreateUserSession {
|
||||
|
||||
private $ci;
|
||||
private $user;
|
||||
private $sessionArray;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
}
|
||||
|
||||
public function handle( $user )
|
||||
{
|
||||
$this->setUser( $user );
|
||||
|
||||
$this->setSessionArray();
|
||||
|
||||
$this->createSession();
|
||||
}
|
||||
|
||||
private function setUser( $user )
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
private function setSessionArray()
|
||||
{
|
||||
$this->sessionArray = [
|
||||
'userID' => $this->user->id,
|
||||
'role' => $this->user->role
|
||||
];
|
||||
}
|
||||
|
||||
private function createSession()
|
||||
{
|
||||
$this->ci->session->set_userdata( $this->sessionArray );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user