/** * Store a newly created resource in storage. * * @return Response */ public function store() { $input = Input::all(); $v = Validator::make(Input::All(), array('name' => 'required', 'lname' => 'required', 'phone' => 'required|max:16|min:10', 'email' => 'required|email|unique:tenants')); if ($v->passes()) { Tenant::create($input); return Redirect::intended('admin/tenants'); } return Redirect::back()->withInput()->withErrors($v)->with('message', 'There were validation errors'); }
public function store() { //first create the user in the public schema $username = Input::get('username'); $password = Hash::make(Input::get('password')); $data = array('username' => $username, 'password' => $password); $tenant = Tenant::create(['subdomain' => $username, 'password' => $password]); //fire the event that moves between schemas and creates the users table in the schema of this tenant Event::fire('tenant.create', [$data]); return 'your account was created successfully. You can access your admin panel in ' . $username . '.local.dev. Your data access is admin/[yourpassword]'; }