public static function linkForUserProfile() { $first_name = Auth::user()->first_name; $last_name = Auth::user()->last_name; $link_admin = ''; $user = User::find(Auth::user()->getAuthIdentifier()); foreach ($user->roles as $role) { if ($role->role == "admin") { $link_admin = '<li class="' . LinksInMenu::isActive(URL::route('admin')) . '"> <a href ="' . URL::route('admin') . '">Админ панель</a> </li>'; } } $link_user = '******' . LinksInMenu::isActive(URL::route('profile')) . '"> <a href="' . URL::route('profile') . '">' . $first_name . ' ' . $last_name . '</a> </li>'; $link_logout = '<li><a href="/logout">Выход</a></li>'; return $link_admin . $link_user . $link_logout; }
public function postAuth() { $data = Input::all(); $remember = isset($data['remember']) ? true : false; $validator = Validator::make($data, WorkWithInput::rulesForInputAuth(), WorkWithInput::messagesForErrors()); $userMessages = $validator->messages(); $emailError = $userMessages->first('email'); $passwordError = $userMessages->first('password'); $result['errors'] = array($emailError, $passwordError); if ($userMessages->has('email') || $userMessages->has('password')) { return $result; } if (Auth::attempt(array('email' => $data['email'], 'password' => $data['password']), $remember)) { $result['authOk'] = LinksInMenu::echoAuthMode(); $result['backUrl'] = $this->getBackUrl(); return $result; } $result['errors']['1'] = "Нет такого пользователя"; return $result; }
<!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li <?php echo LinksInMenu::isActive(URL::route('vanguard')); ?> > <a href="<?php echo URL::route('vanguard'); ?> ">Стажировка</a> </li> <?php echo LinksInMenu::linkForMainMenu(); ?> </ul> <ul class="nav navbar-nav navbar-right"> <?php echo LinksInMenu::echoAuthMode(); ?> </ul> <?php echo View::make('vanguard.loginModal'); ?> </div> <!-- /.navbar-collapse --> </div> <!-- /.container-fluid --> </nav> </header> </div>