file_put_contents() takes the filename/path and the data you want to write.
Your restore method is actually writing the temporary location of where the database is uploaded to, as a string, to the location you specify.
That's why the file turns up in the right location, but contains a string as opposed to the actual database.
It depends how elegant you want your solution to be. One solution could be to do the following:
First - Create a new 'disk' to store your databases - this will also make it easier later on to retrieve the files as required
//config/filesystems.php
'databases' => [
'driver' => 'local',
'root' => database_path(),
],
Second - Now you can just store it off the $request object:
public function restore(Request $request)
{
//Store the file in the 'databases' storage 'disk' using the name of the uploaded file
$path = $request->file('database')->store($request->database, 'databases');
return $path;
}
More information - https://laravel.com/docs/5.5/filesystem#file-uploads specifically, 'Specifying A Disk'