本文整理汇总了PHP中app\models\Setting::getErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::getErrors方法的具体用法?PHP Setting::getErrors怎么用?PHP Setting::getErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Setting
的用法示例。
在下文中一共展示了Setting::getErrors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionInit
public function actionInit()
{
$model = new User();
$model->username = 'admin';
$model->auth_key = 'OocVKRx-iludROmUFYj4HmxNeC8v0-FG';
$model->password_hash = '$2y$13$0d3FeUDYGSyZft.3I77hV.E357FsqqAJFqaWPstWODMbdlSvxV2gC';
$model->email = 'sintret@gmail.com';
$model->phone = '6281575068530';
$model->role = User::ROLE_ADMIN;
$model->status = User::STATUS_ACTIVE;
if ($model->save()) {
echo 'success insert user, with usename:admin and password:123456';
} else {
echo json_encode($model->getErrors());
}
$setting = new Setting();
$setting->emailAdmin = 'sintret@gmail.com';
$setting->emailSupport = 'sintret@gmail.com';
$setting->emailOrder = 'sintret@gmail.com';
$setting->facebook = 'https://www.facebook.com/sintret';
$setting->instagram = 'https://instagram.com/andyfitria/';
$setting->google = 'https://google.com/sintret/';
if ($setting->save()) {
echo "\r\n success insert basic settings";
} else {
echo json_encode($setting->getErrors());
}
}
示例2: 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');
}
}