<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Storage;

class S3Controller extends Controller
{
	// private $url = "https://s3-dev-gisplus.s3.us-west-2.amazonaws.com/dev/estatech/test/";
	// private $url_2 = "dev/estatech/test/";

	private $url = "https://s3-dev-gisplus.s3.us-west-2.amazonaws.com/dev/estatech/test/";
	private $url_2 = "dev/estatech/test/";

    public function uploadFile($file)
    {
    	$name = uniqid().'.'.$file->getClientOriginalExtension();

    	Storage::disk('s3')->put($this->url_2.$name,file_get_contents($file),'public');

    	return $name;
    }

    public function getFile($file_name)
    {
    	Storage::disk('s3')->get($file_name);
    }

    public function unlinkFile($file_name)
    {
        Storage::disk('s3')->delete($file_name);
    }
}
