public function postRegister(CreateUserRequest $request) { $user = new \App\users(); $user['firstname'] = $request->input('firstname'); $user['lastname'] = $request->input('lastname'); $user['email'] = $request->input('email'); $user['password'] = $request->input('password'); $user['addressline_1'] = $request->input('addressline_1'); $user['addressline_2'] = $request->input('addressline_2') == null ? null : $request->input('addressline_2'); $user['addressline_3'] = $request->input('addressline_3') == null ? null : $request->input('addressline_3'); $user['city'] = $request->input('city'); $user['country'] = $request->input('country'); $user['postcode'] = $request->input('postalcode'); $user['mobilenumber'] = $request->input('mobilenumber'); $user['roleid'] = '3'; $user->save(); \Session::flash('message', 'Registered Successfully!'); \Session::flash('type', 'success'); return redirect('/register'); }
public function postregister(Request $request) { $this->validate($request, ['name' => 'required|max:50|unique:users', 'email' => 'required|unique:users', 'password' => 'required|min:6|max:12']); $user = new \App\users(); $user->email = $request->input('email'); $user->password = $request->input('password'); $user->name = $request->input('name'); $user->save(); $status = new \App\statususers(); $status->username = $request->input('name'); $status->save(); Session::set('id', $user->id); Session::set('email', $user->email); Session::set('status', $user->status); Session::set('name', $user->name); Session::set('logout', "logout"); if (Session::get('status') == 1) { return redirect('/admin'); } else { return redirect('/index/' . Session::get('name')); } }
<?php /* |-------------------------------------------------------------------------- | Routes File |-------------------------------------------------------------------------- | | Here is where you will register all of the routes in an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('users/{id}', function ($id) { $user = App\users::find($id); echo $user->name; }); /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | This route group applies the "web" middleware group to every route | it contains. The "web" middleware group is defined in your HTTP | kernel and includes session state, CSRF protection, and more. | */ Route::group(['middleware' => 'web'], function () { Route::auth(); Route::get('/', function () { return view('welcome'); });