Advertisement
Guest User

Untitled

a guest
Jan 26th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.47 KB | None | 0 0
  1. <?php
  2.  
  3. class UserController extends \BaseController {
  4.  
  5.     public function index()
  6.     {
  7.         /*
  8.         if (Auth::check()) {
  9.             return View::make('user.dashboard');
  10.         }
  11.         */
  12.                
  13.     }
  14.  
  15.     /**
  16.      * Show the form for creating a new resource.
  17.      *
  18.      * @return Response
  19.      */
  20.     public function create()
  21.     {
  22.         return View::make('user.create'); // login view
  23.     }
  24.  
  25.  
  26.     /**
  27.      * Store a newly created resource in storage.
  28.      *
  29.      * @return Response
  30.      */
  31.     public function store() {
  32.  
  33.         if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input::get('password')))) {
  34.             //return Redirect::to('user/dashboard')->with('message', 'You are now logged in!');
  35.              $user_data = Auth::user();
  36.  
  37.              Session::put('id', $user_data->id);    
  38.              Session::put('firstname', $user_data->firstname);
  39.              Session::put('lastname', $user_data->lastname);
  40.              Session::put('email', $user_data->email);
  41.  
  42.              return Redirect::intended('user/dashboard');
  43.  
  44.         } else {
  45.             return Redirect::to('user/create')
  46.                 ->with('message', 'Your username/password combination was incorrect')
  47.                 ->withInput();
  48.         }
  49.     }
  50.  
  51.  
  52.     /**
  53.      * Remove the specified resource from storage.
  54.      *
  55.      * @param  int  $id
  56.      * @return Response
  57.      */
  58.     public function destroy($id)
  59.     {
  60.         Auth::logout();
  61.         Session::flush();
  62.         return Redirect::to('pages/home')->with('message', 'Your are now logged out!');
  63.     }
  64.  
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement