/** * Store a newly created resource in storage. * * @param Request|Requests\HostelRequestCreate $request * @return \Illuminate\Http\Response */ public function store(Requests\HostelRequestCreate $request) { $user = User::create(['name' => $request->input('name'), 'email' => $request->input('email'), 'password' => bcrypt($request->input('password'))]); $newHostel = Hostel::create(['telefone' => $request->input('telefone'), 'user_id' => $user->id, 'descri' => $request->input('descri')]); return redirect(route('hostels.index')); }
/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); }