/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ public function create(array $data) { $registration_link = RegistrationLink::valid()->where('_token', $data['_reg_token'])->first(); $group_id = 2; // At this moment this is ID for users if ($registration_link) { $group_id = $registration_link->group_id; $registration_link->delete($data['_reg_token']); } return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'group_id' => $group_id, 'active' => true]); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { RegistrationLink::find($id)->first()->delete(); Session::flash('flash_message', 'Registration token has been deleted'); Session::flash('flash_success', 'true'); return redirect('/admin/user/create'); }
public function run() { DB::table('registration_links')->delete(); RegistrationLink::create(['_token' => '2cttE3cuVvA1uixKDvadwMn4Cl0O62dIeP1RT1JQ', 'group_id' => 1, 'valid_until' => date('Y-m-d H:m:s', strtotime('+1 day'))]); }