Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class UserController extends \BaseController {
- public function index()
- {
- /*
- if (Auth::check()) {
- return View::make('user.dashboard');
- }
- */
- }
- /**
- * Show the form for creating a new resource.
- *
- * @return Response
- */
- public function create()
- {
- return View::make('user.create'); // login view
- }
- /**
- * Store a newly created resource in storage.
- *
- * @return Response
- */
- public function store() {
- if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input::get('password')))) {
- //return Redirect::to('user/dashboard')->with('message', 'You are now logged in!');
- $user_data = Auth::user();
- Session::put('id', $user_data->id);
- Session::put('firstname', $user_data->firstname);
- Session::put('lastname', $user_data->lastname);
- Session::put('email', $user_data->email);
- return Redirect::intended('user/dashboard');
- } else {
- return Redirect::to('user/create')
- ->with('message', 'Your username/password combination was incorrect')
- ->withInput();
- }
- }
- /**
- * Remove the specified resource from storage.
- *
- * @param int $id
- * @return Response
- */
- public function destroy($id)
- {
- Auth::logout();
- Session::flush();
- return Redirect::to('pages/home')->with('message', 'Your are now logged out!');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement