/** * Store a newly created resource in storage. * * @return Response */ public function store(UserRequest $request) { $userId = strtoupper($request->get('user_id')); $InitUserId = substr($userId, 0, 3); $user = new User(); $InitUserId == 'TCH' ? $user->teacher_id = $userId : null; $InitUserId == 'STD' ? $user->student_id = $userId : null; $InitUserId == 'ADM' ? $user->teacher_id = $userId : null; $user->firstname = $request->get('firstname'); $user->lastname = $request->get('lastname'); $user->email = $request->get('email'); $user->phone = $request->get('phone'); $user->dob = $request->get('dob'); $user->gender = $request->get('gender'); $user->address = $request->get('address'); $user->state = $request->get('state'); $user->nationality = $request->get('nationality'); //$user->password = Hash::make($request->get('password')); $user->save(); dd(Hash::make($request->get('password'))); User::create($input); return redirect()->route('account.login')->with('message', '<span class="alert alert-success">Welcome Created</span>'); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['firstname' => $data['firstname'], 'lastname' => $data['lastname'], 'phone' => $data['phone'], 'dob' => $data['dob'], 'address' => $data['address'], 'state' => $data['state'], 'nationality' => $data['nationality'], 'type' => $data['type'], 'userId' => $data['userId'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'image' => $data['image']]); }