Route::post('user/{id}', function (Request $request, $id) { // Get the file from the request
$file = $request->file('image'); // Get the contents of the file
$contents = $file->openFile()->fread($file->getSize()); // Store the contents to the database
$user = App\User::find($id);
$user->avatar = $contents;
$user->save();
});