本文整理汇总了PHP中app\Config::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::save方法的具体用法?PHP Config::save怎么用?PHP Config::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Config
的用法示例。
在下文中一共展示了Config::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveConfigs
protected function saveConfigs()
{
foreach ($this->configs as $key => $value) {
$config = Config::where('key', '=', $key)->first();
if ($config == null) {
$config = new Config();
}
$config->key = $key;
$config->value = $value;
$config->save();
}
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(UserCreateFormRequest $request)
{
if (Auth::check() && $this->rolechucnangs && $this->rolechucnangs->Them == 1) {
if ($request->input('doi') == 0) {
$doi = NULL;
} else {
$doi = $request->input('doi');
}
$capbac = $request->input('capbac');
if ($capbac == 0) {
$capbac = NULL;
}
$chucvu = $request->input('chucvu');
if ($chucvu == 0) {
$chucvu = NULL;
}
if ($request->input('canhan') == 'on') {
$canhan = 1;
} else {
$canhan = NULL;
}
$config = new Config(['layout' => '', 'navbar' => '', 'sidebar' => '', 'breadcrumbs' => '', 'compactsidebar' => '']);
$config->save();
$config_id = $config->id;
$user = new User(array('username' => $request->input('username'), 'name' => $request->input('name'), 'email' => $request->input('email'), 'password' => \Hash::make($request->input('password')), 'role_id' => $request->input('role'), 'doi_id' => $doi, 'phong_id' => $request->input('phong'), 'canhan' => $canhan, 'config_id' => $config_id, 'capbac_id' => $capbac, 'chucvu_id' => $chucvu));
$user->save();
$insertedId = $user->id;
//get user insert id
$role_id = $request->input('role');
// get role id
$userfind = User::find($insertedId);
$userfind->assignRole($role_id);
return \Redirect::route('user.index')->with('message', 'Lưu thành công!');
} else {
return \Redirect::route('user.index')->with('message-error', 'Không có quyền truy cập');
}
}