我的配置文件夹中有一个文件消息
'msg_log' => [
'created' => 'created successfully',
'not_created' => 'not created',
] 我在数据库中有一个表作为消息,有两个字段作为类型,如果创建的话应该创建,如果没有创建则不创建,其他字段是msg强>应该有消息 我如何通过 Controller 中的存储方法将其保存到我的消息表中
public function store(Request $request)
{
$data['email'] = $request->input('email');
$data['password'] = bcrypt($request->input('password'));
$user = User::create($data);
if($user->id) {
// If Created Here
}else{
// Not created
}
请告诉我如何在 if else 中保存消息表中的类型和消息 谢谢
最佳答案
你应该试试这个
public function store(Request $request)
{
$data['email'] = $request->input('email');
$data['password'] = bcrypt($request->input('password'));
if(User::create($data)) {
// If Created Here
}else{
// Not created
}
}
关于php - 将配置文件中的数据保存到数据库(Laravel 5.3),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40734654/