/** * Get user member on acl_user_member */ public static function getUserMember($userId) { $member = UserMember::with(array('group', 'user'))->where('user_id', $userId)->get(); $userMember = array(); foreach ($member as $row) { $userMember[] = $row->group_id; } return $userMember; }
public function player() { if (ACL::checkUserPermission('points.player') == false) { return Redirect::action('dashboard'); } $form_open = Form::open(array('method' => 'post', 'files' => true, 'id' => 'form-player-csv', 'class' => 'smart-form', 'role' => 'form')); $userList = UserMember::with('user', 'group', 'points')->where('group_id', 4)->get(); $title = Lang::get('Player List'); $client_ip = Request::getClientIp(true); $data = array('acl' => ACL::buildACL(), 'userList' => $userList, 'title' => $title, 'form_open' => $form_open, 'client_ip' => $client_ip); return View::make('points/index', $data); }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (ACL::checkUserPermission('player.index') == false) { return Redirect::action('dashboard'); } $form_open = Form::open(array('method' => 'post', 'files' => true, 'id' => 'form-player-csv', 'class' => 'smart-form', 'role' => 'form')); $userList = UserMember::with('user', 'group', 'points')->where('group_id', 4)->get(); $title = Lang::get('Player List'); $status = array('0' => array('label' => 'default', 'status' => 'Inactive'), '1' => array('label' => 'success', 'status' => 'Active')); $user = $userList->toArray(); $data = array('acl' => ACL::buildACL(), 'userList' => $userList, 'title' => $title, 'status' => $status, 'form_open' => $form_open); return View::make('player/index', $data); }
public function isPlayer() { $isPlayer = UserMember::with('group')->where('user_id', Auth::user()->id)->get(); foreach ($isPlayer as $group) { if (strpos(strtolower($group->group->name), 'player') !== false) { return true; } } return false; }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { if (ACL::checkUserPermission('user.show') == false) { return Redirect::action('dashboard'); } $title = Lang::get('User Info'); $userInfo = User::find($id); $userMember = UserMember::with('group')->where('user_id', $id)->get(); $userAccess = ACL::checkPermission($id); if (!empty($userInfo)) { return View::make('user/show', array('userInfo' => $userInfo, 'userMember' => $userMember, 'userAccess' => $userAccess['access'], 'title' => $title)); } else { $message = 'Cannot find User Info'; return Redirect::Action('settings.user')->with('error', $message); } }
$user = Auth::user(); $settingsExpiry = Settings::getSettingValue('password_expiry'); $expirationDate = User::userPasswordExpiry($user->password_expiration_date, $settingsExpiry); if (strtotime($expirationDate) < strtotime($date)) { $msgType = 'warning'; $message = 'Your password has been expired. Please change your password.'; return Redirect::action('user.profile')->with($msgType, $message); } } else { $errorMsg = 'Please login using your credentials'; return Redirect::action('login.index')->with('error', $errorMsg); } }); Route::filter('check_merchant', function () { if (Auth::check()) { $userMember = UserMember::with('group')->where('user_id', Auth::user()->id)->get(); if ($userMember->count() > 0) { $fetch = array_fetch($userMember->toArray(), 'group.name'); if (in_array('Merchant', $fetch)) { $merchant_id = Auth::user()->id; $merchant = Merchant::find($merchant_id); $merchant_arr = array('merchant_id' => $merchant_id); Session::put('merchant', $merchant_arr); } } } else { $errorMsg = 'Please login using your credentials'; return Redirect::action('login.index')->with('error', $errorMsg); } }); /*