繁体   English   中英

将数据从配置文件保存到数据库(Laravel 5.3)

[英]Save data from config file to db (Laravel 5.3)

我的配置文件夹中有一个文件消息

'msg_log' => [
        'created' => 'created successfully',
        'not_created' => 'not created',

]我在数据库中有一个表作为消息 ,有两个字段作为类型 ,如果已创建则创建该字段,如果未创建则不创建,其他字段为msg应该发送消息,如何将其从控制器中的存储方法保存到我的消息表中

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 

     }

请告诉我该怎么做,否则在消息表中保存该类型味精谢谢

你应该试试这个

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 
   }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM