I want to get the value of activationCode from database and then store it into a .txt file.
This is what I tried to so far.
Please help!
registerController.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);
}
myfile.txt
. [{"id":2,"name":"sara","email":"[email protected]","phone":"011164305","activationCode":8833,"is_active":0,"email_verified_at":null,"created_at":"2018-10-23 16:33:06","updated_at":"2018-10-23 16:33:06"},... Now, I want to get the activationCode value and show it to the user so they can use this code to activate their account using phone number. – Snafu