예제 #1
0
 public function showWelcome()
 {
     $message = '';
     //getting a flash message when a new chat room is created
     if (Session::has('message')) {
         $message = Session::get('message', 'default');
         Session::forget('message');
     }
     if (Auth::user()) {
         $chat_rooms = $this->getJoinedChatRooms();
         $unread_messages_counts = $this->getUnreadMessagesCount($chat_rooms);
         $online_members_per_room = $this->getOnlineMembers($chat_rooms);
         $available_chat_rooms = $this->getAvailableChatRooms();
         $invited_chatrooms = $this->getInvitedChatRoomDetails();
         $registered = Online::registered()->distinct('user_id')->get();
         $online_users = '';
         foreach ($registered as $register) {
             $online_users[] = $register->user_id;
         }
         //$online_users = array_unique($online_users);			var_dump($online_users);die();
         $user_names = User::select('first_name')->whereIn('id', array_unique($online_users))->lists('first_name');
         return View::make('home', array('chatrooms' => $chat_rooms, 'online_members' => $online_members_per_room, 'user_names' => $user_names, 'message' => $message, 'available_chat_rooms' => $available_chat_rooms, 'unread_messages_counts' => $unread_messages_counts, 'invited_chatrooms' => $invited_chatrooms));
     } else {
         Online::updateCurrent();
     }
     return View::make('home');
 }
예제 #2
0
<?php

// Home
Online::updateCurrent();
Route::get('/', array('as' => 'home', 'uses' => 'HomeController@showWelcome'));
// Unauthenticated group
Route::group(array('before' => 'guest'), function () {
    // CSRF protection group
    Route::group(array('before' => 'csrf'), function () {
        // Sign In post
        Route::post('account/sign-in', array('as' => 'sign-in-post', 'uses' => 'AccountController@postSignIn'));
        // Sign Up post
        Route::post('account/sign-up', array('as' => 'sign-up-post', 'uses' => 'AccountController@postSignUp'));
        // Forgot password post
        Route::post('account/forgot-password', array('as' => 'forgot-password-post', 'uses' => 'AccountController@postForgotPassword'));
    });
    // Sign In
    Route::get('account/sign-in', array('as' => 'sign-in', 'uses' => 'AccountController@getSignIn'));
    // Sign Up
    Route::get('account/sign-up', array('as' => 'sign-up', 'uses' => 'AccountController@getSignUp'));
    // Activate account
    Route::get('account/activate/{code}', array('as' => 'activate-account', 'uses' => 'AccountController@getActivateAccount'));
    // Forgot password
    Route::get('account/forgot-password', array('as' => 'forgot-password', 'uses' => 'AccountController@getForgotPassword'));
    // Activate temporary password
    Route::get('account/forgot-password/{user}/{code}', array('as' => 'forgot-password-activate', 'uses' => 'AccountController@getForgotPasswordActivate'));
});
// Authenticated group
Route::group(array('before' => 'auth'), function () {
    // CSRF protection group
    Route::group(array('before' => 'csrf'), function () {