Пример #1
0
 public function destroy()
 {
     if (FEUsersHelper::isLogged()) {
         Session::flush('user');
     }
     return Redirect::to('/');
 }
Пример #2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     if (FEUsersHelper::isLogged()) {
         return Redirect::to('/');
     }
     return View::make('frontend/users/create');
 }
Пример #3
0
 public function store()
 {
     if (FEUsersHelper::isLogged()) {
         $current_user_id = Session::get('user')['id'];
         $r_user_id = Input::get('r_user_id');
         $conversations = Conversation::where(function ($query) use($current_user_id, $r_user_id) {
             $query->where('user1_id', '=', $current_user_id)->where('user2_id', '=', $r_user_id);
         })->orWhere(function ($query) use($current_user_id, $r_user_id) {
             $query->where('user1_id', '=', $r_user_id)->where('user2_id', '=', $current_user_id);
         })->orderBy('updated_at', 'DESC')->get();
         $message = new Message();
         if ($conversations->count() > 0) {
             $conversation = $conversations->first();
             $message->content = Input::get('content');
             $message->s_user_id = $current_user_id;
             $message->conversation_id = $conversation->id;
             $message->save();
             $conversation->updated_at = date('Y-m-d H:m:s');
             $conversation->save();
             return Redirect::to('message/' . $conversation->id);
         } else {
             $conversation = new Conversation();
             $conversation->user1_id = $current_user_id;
             $conversation->user2_id = Input::get('r_user_id');
             $conversation->save();
             $message->content = Input::get('content');
             $message->s_user_id = $current_user_id;
             $message->conversation_id = $conversation->id;
             $message->save();
             return Redirect::to('message/' . $conversation->id);
         }
     }
     return Redirect::to('/');
 }
Пример #4
0
 public function create()
 {
     if (!FEUsersHelper::isLogged()) {
         return View::make('frontend/signin_signup/signup');
     } else {
         return Redirect::to('/');
     }
 }
Пример #5
0
 public function create()
 {
     if (FEUsersHelper::isLogged()) {
         return View::make('frontend/blogs/create')->with('user', Session::get('user'));
     } else {
         return Redirect::to('/');
     }
 }
Пример #6
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     if (!FEUsersHelper::isLogged()) {
         return Redirect::to('/');
     } else {
         return View::make('frontend/products/create');
     }
 }
Пример #7
0
 public function getIndex()
 {
     if (FEUsersHelper::isLogged()) {
         $entries = $this->getViewIndexDatas()['datas'];
         $suggests = $this->getViewIndexDatas()['suggestes'];
         $left_albums = $this->getViewIndexDatas()['left_albums'];
         $user = User::find(Session::get('user')['id']);
         return View::make('frontend/index')->with('entries', $entries)->with('suggestes', $suggests)->with('user', $user)->with('left_albums', $left_albums);
     } else {
         return Redirect::to('login');
     }
 }
Пример #8
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $product_id = Input::get('id');
     FEExchangesHelper::selectProduct($product_id);
     $messages = array();
     if (FEUsersHelper::isLogged()) {
         if (FEExchangesHelper::isProductSelected()) {
             $s_user_id = Session::get('current_user');
             $products = Product::where('user_id', '=', $s_user_id)->where('public', '=', '1')->where('status', '=', 0)->get();
             return View::make('frontend/exchanges/create')->with('products', $products);
         } else {
             Session::flash('status', false);
             $messages[] = 'Bạn cần chọn sản phẩm trước';
             Session::flash('messages', $messages);
             return Redirect::to('/');
         }
     } else {
         Session::flash('status', false);
         $messages[] = 'Bạn cần đăng nhập';
         Session::flash('messages', $messages);
         return Redirect::to('/');
     }
 }
Пример #9
0
 public static function isCurrentUser($id)
 {
     if (FEUsersHelper::isLogged()) {
         if ($id == Session::get('current_user')) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }