Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Route::resource('users', 'UsersController');
- Route::get('users/signin', 'UsersController@getSignin');
- Route::get('users/newaccount', 'UsersController@getSignup');
- <?php
- namespace AppHttpControllers;
- use IlluminateHttpRequest;
- use AppHttpRequests;
- use View;
- class UsersController extends Controller
- {
- public function __construct(){
- parent::__construct();
- }
- /**
- * Display a listing of the resource.
- *
- * @return IlluminateHttpResponse
- */
- public function index()
- {
- //
- }
- /**
- * Show the form for creating a new resource.
- *
- * @return IlluminateHttpResponse
- */
- public function create()
- {
- return View::make('users.newaccount');
- }
- /**
- * Store a newly created resource in storage.
- *
- * @param IlluminateHttpRequest $request
- * @return IlluminateHttpResponse
- */
- public function store(Request $request)
- {
- $validator = Validator::make(Input::all(), User::$rules);
- if($validator->passes()){
- $user = new User;
- $user->name = Input::get('name');
- $user->email = Input::get('email');
- $user->password = Input::get('password');
- $user->save();
- return Redirect::to('users/signin')->with('message','Thank you for creating new account.Sign in now');
- }
- return Redirect::to('users/newaccount')->with('message','Something went wrong!')->withErrors($validator)->withInput();
- }
- public function getSignin(){
- return View::make('users.signin');
- }
- /**
- * Display the specified resource.
- *
- * @param int $id
- * @return IlluminateHttpResponse
- */
- public function show($id)
- {
- //
- }
- /**
- * Show the form for editing the specified resource.
- *
- * @param int $id
- * @return IlluminateHttpResponse
- */
- public function edit($id)
- {
- //
- }
- /**
- * Update the specified resource in storage.
- *
- * @param IlluminateHttpRequest $request
- * @param int $id
- * @return IlluminateHttpResponse
- */
- public function update(Request $request, $id)
- {
- //
- }
- /**
- * Remove the specified resource from storage.
- *
- * @param int $id
- * @return IlluminateHttpResponse
- */
- public function destroy($id)
- {
- //
- }
- public function getSignout(){
- Auth::logout();
- return Redirect::to('users/signin')->with('message','Signouted!');
- }
- /*public function postSignin(){
- if(Auth::attempt(array('name' => Input::get('name'), 'email' => Input::get('email'), 'password'=> 'Input::get('password')))){
- return Redirect::to('/')->with('message','Thanks for signin');
- }
- return Redirect::to('users/singin')->with('message','Was Incorrect DATA!');
- } */
- }
- {!! Form::open(array('url' => 'users/signin' , 'method' => 'post')) !!}
- <div class="form-group">
- <label for="username">User Name:</label>
- <input type="username" class="form-control" name="name" id="name">
- </div>
- <div class="form-group">
- <label for="username">Password:</label>
- <input type="username" class="form-control" name="password" id="name">
- </div>
- <button type="submit" class="btn btn-default">Sign IN</button>
- {!! Form::close() !!}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement