mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-14 18:02:01 -04:00
35 lines
928 B
PHP
35 lines
928 B
PHP
<?php
|
|
|
|
namespace Modules\StudioPlus\Services;
|
|
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
use Modules\StudioPlus\Imports\StudioPlusVideoImport;
|
|
use Illuminate\Support\Str;
|
|
|
|
class ImportService
|
|
{
|
|
public function handleUpload($file)
|
|
{
|
|
$filename = $file->getClientOriginalName();
|
|
$temp_path = $this->getTempLocalStoragePath();
|
|
Storage::put("$temp_path/path.dat", $temp_path);
|
|
$temp_filename = Str::random() . $filename;
|
|
Storage::putFileAs($temp_path, $file, $temp_filename);
|
|
|
|
return "$temp_path/$temp_filename";
|
|
}
|
|
|
|
public function importVideos($path)
|
|
{
|
|
ini_set('memory_limit', '6000M');
|
|
Excel::import(new StudioPlusVideoImport, $path);
|
|
Storage::delete($path);
|
|
}
|
|
|
|
public function getTempLocalStoragePath()
|
|
{
|
|
return "CreatorStudio/temp/import";
|
|
}
|
|
}
|