After upgrading Laravel from 5.6 to 6.0, Call to undefined str_random() function not working

后端 未结 4 1044
说谎
说谎 2020-12-15 06:29

I have upgraded Laravel from 5.6 to 6.0. Previously, default helper functions were running fine on the controllers, but now it says \"undefined.\" In my con

4条回答
  •  粉色の甜心
    2020-12-15 07:24

    use code ::

    insertGetId( [
                        'name'=>'Sample'.$count,
                        'password'=>random_int(1000000,99999999)
                    ]);
                    foreach (range(1,rand(1,3)) as $index ){
                        DB::insert('INSERT INTO posts (userid,title,body) VALUES (:userid,:title,:body)',[
                                'userid'=>$id,
                                'title'=>str::random(15),
                                'body'=>str::random(50),
                            ]);
                    }
                    DB::commit();
                }
            }catch (\Exception $errors){
                DB::rollBack();
                Log::error($errors);
                return "mission filed";
            }
        }
    

提交回复
热议问题