/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $register = new Registrar(); $validator = $register->validator($request->all()); if ($validator->fails()) { $this->throwValidationException($request, $validator); } if ($register->create($request->all())) { Notification::success('创建用户成功'); } return redirect()->route('backend.user.index'); }
/** * Register/create a new user. * * @param Registrar $registrar * @return * */ public function postRegister(Registrar $registrar) { //make sure that admin has enabled regisration before proceeding if (!App::make('Settings')->get('enableRegistration', true) && !Auth::user()->isAdmin) { return response(trans('app.registrationDisabled'), 403); } $validator = $registrar->validator(Input::all()); if ($validator->fails()) { return response()->json($validator->errors(), 400); } $user = $registrar->create(Input::all()); //create a root folder for this user Folder::create(['name' => 'root', 'share_id' => str_random(15), 'user_id' => $user->id, 'description' => trans('app.rootAlbumDesc')]); if (IS_DEMO && Input::has('createDemoContent')) { App::make('\\App\\Services\\DemoContentCreator')->create($user); } //if user is not logged in, do it now if (!Auth::check()) { Auth::login($user); } return $user; }
public function run() { $data = ['name' => 'admin', 'email' => '*****@*****.**', 'password' => '123456']; $register = new Registrar(); $register->create($data); }
public function postAvatar(Request $request) { $message = "プロフィール画像の変更が完了しました。"; $avatar = $request->file('avatar'); //例外処理 if (!is_null($avatar) && $avatar->getError() > 0) { // $alert = $avatar->getErrorMessage(); $alert = "画像が不正か、サイズが大きすぎる場合があります。"; return redirect()->to('mypage/avatar')->withInput(array("alert" => $alert)); } //バリデーション $validation = array('avatar' => 'image|mimes:jpeg,jpg,gif,png|max:2000', 'radioAvatarType' => 'required'); $this->validate($request, $validation); $register = new Registrar(); $returnArray = $register->saveAvatar($request->all()); $oldPath = $this->user->avatar; if (preg_match("/^\\/avatar/", $oldPath) && is_file(public_path($oldPath))) { //avatarPathが/avatar/からのパスなら既存のファイルを削除 if (!unlink(public_path($oldPath))) { return redirect()->to('mypage/index')->withInput(['message' => '既存のファイルの削除に失敗しました。お問い合わせフォームにてご連絡ください。']); } } $this->user->avatar = $returnArray['path']; $this->user->save(); return redirect()->to('mypage/index')->withInput(array("message" => $message)); }
public function run() { $data = ['name' => 'admin', 'type' => 'admin', 'mobile' => '12345678912', 'email' => '*****@*****.**', 'password' => '123456', 'desc' => '管理员']; $register = new Registrar(); $register->create($data); }
/** * @param $user_id * @param Registrar $registrar * @return mixed */ public function resendConfirmationEmail($user_id, Registrar $registrar) { $registrar->resendConfirmationEmail($user_id); return redirect()->back()->withFlashSuccess("A new confirmation e-mail has been sent to the address on file."); }
public function run() { $data = ['name' => 'LinZH', 'email' => '*****@*****.**', 'password' => '235033', 'desc' => '管理员']; $register = new Registrar(); $register->create($data); }
public function run() { $data = ['name' => 'cirrus', 'email' => '*****@*****.**', 'password' => 'admin', 'desc' => '管理员']; $register = new Registrar(); $register->create($data); }