我想从数据库中获取 activationCode 的值,然后将其存储到 .txt 文件中。
这是我到目前为止所尝试的。
请帮忙!
注册控制器.php
protected function create(array $data)
{
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'phone' => $data['phone'],
'password' => bcrypt($data['password']),
'activationCode' => rand(1000,9999),
]);
}
public function put() {
$user = User::where('is_active', 0)->get();
$file = Storage::put( 'myfile.txt', $user);
}
Run Code Online (Sandbox Code Playgroud)