當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Setting::isValid方法代碼示例

本文整理匯總了PHP中app\models\Setting::isValid方法的典型用法代碼示例。如果您正苦於以下問題:PHP Setting::isValid方法的具體用法?PHP Setting::isValid怎麽用?PHP Setting::isValid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Setting的用法示例。


在下文中一共展示了Setting::isValid方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postSaveFirstAdmin

 /**
  * Save the first admin user from Setup.
  *
  * @author [A. Gianotto] [<snipe@snipe.net>]
  * @since [v3.0]
  * @return Redirect
  */
 public function postSaveFirstAdmin(SetupUserRequest $request)
 {
     $user = new User();
     $user->first_name = $data['first_name'] = e(Input::get('first_name'));
     $user->last_name = e(Input::get('last_name'));
     $user->email = $data['email'] = e(Input::get('email'));
     $user->activated = 1;
     $permissions = array('superuser' => 1);
     $user->permissions = json_encode($permissions);
     $user->username = $data['username'] = e(Input::get('username'));
     $user->password = bcrypt(Input::get('password'));
     $data['password'] = Input::get('password');
     $settings = new Setting();
     $settings->site_name = e(Input::get('site_name'));
     $settings->alert_email = e(Input::get('email'));
     $settings->alerts_enabled = 1;
     $settings->brand = 1;
     $settings->locale = 'en';
     $settings->default_currency = 'USD';
     $settings->user_id = 1;
     $settings->email_domain = e(Input::get('email_domain'));
     $settings->email_format = e(Input::get('email_format'));
     if (!$user->isValid() || !$settings->isValid()) {
         return redirect()->back()->withInput()->withErrors($user->getErrors())->withErrors($settings->getErrors());
     } else {
         $user->save();
         $settings->save();
         if (Input::get('email_creds') == '1') {
             Mail::send(['text' => 'emails.firstadmin'], $data, function ($m) use($data) {
                 $m->to($data['email'], $data['first_name']);
                 $m->subject('Your Snipe-IT credentials');
             });
         }
         return redirect()->route('setup.done');
     }
 }
開發者ID:stijni,項目名稱:snipe-it,代碼行數:43,代碼來源:SettingsController.php


注:本文中的app\models\Setting::isValid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。