protected static function current_user() { // -------------------------------------------------------------- // For Layla // -------------------------------------------------------------- return Auth::user() ?: new Account(); // -------------------------------------------------------------- // End for Layla // -------------------------------------------------------------- }
public static function arrayRoles() { $rolelist = Role::all(); $arrayRole = array(); foreach ($rolelist as $value) { if (Auth::check() && Auth::user()->role != 1 && $value->roleid != 1) { $arrayRole[$value->roleid] = $value->role; } else { $arrayRole[$value->roleid] = $value->role; } } return $arrayRole; }
/** * Test the Auth::logout method. * * @group laravel */ public function testLogoutMethodLogsOutUser() { Session::$instance = new Payload($this->getMock('Laravel\\Session\\Drivers\\Driver')); $data = Session::$instance->session['data']['laravel_auth_drivers_fluent_login'] = 1; Auth::logout(); // A workaround since Cookie will is only stored in memory, until Response class is called. Auth::driver()->token = null; $this->assertNull(Auth::user()); $this->assertFalse(isset(Session::$instance->session['data']['laravel_auth_drivers_fluent_login'])); $this->assertTrue(Cookie::$jar['laravel_auth_drivers_fluent_remember']['expiration'] < time()); }
public static function remData($id) { Cat::find($id)->delete(); Log::write('Data', 'Claims Category Id <b>' . $id . '</b> Remove by ' . Auth::user()->username); }
/** * Test the Auth::logout method. * * @group laravel */ public function testLogoutMethodLogsOutUser() { Session::$instance = new Payload($this->getMock('Laravel\\Session\\Drivers\\Driver')); $data = Session::$instance->session['data']['laravel_auth_drivers_fluent_login'] = 1; Auth::logout(); $this->assertNull(Auth::user()); $this->assertFalse(isset(Session::$instance->session['data']['laravel_auth_drivers_fluent_login'])); $this->assertTrue(Cookie::$jar['laravel_auth_drivers_fluent_remember']['expiration'] < time()); }
/** * Removing Data Information * * @return void * @author **/ public static function remData($id) { Content::find($id)->delete(); Log::write('Data', 'Data Id <b>' . $id . '</b> Remove by ' . Auth::user()->username); }
public static function updateUser($input) { $user = User::find($input['userid']); $profileid = $user->userprofile->profileid; $user->role = $input['role']; $user->status = $input['status']; $user->save(); $prof = array(array('fullname' => $input['fullname'], 'icno' => $input['icno'], 'emel' => $input['emel'])); $profile = Profile::find($profileid); $profile->fullname = $input['fullname']; $profile->icno = $input['icno']; $profile->emel = $input['emel']; $profile->save(); $profile = User::find($input['userid']); Log::write('User', 'Update User ' . $user->userprofile->icno . 'By ' . Auth::user()->username); }
protected static function current_user() { return Auth::user() ?: new User(); }