funcion/actualizar-canasta-desde-compras #39

Merged
rho merged 23 commits from funcion/actualizar-canasta-desde-compras into master 2024-12-27 19:32:17 -03:00
3 changed files with 9 additions and 6 deletions
Showing only changes of commit 95a9a404d2 - Show all commits

View File

@ -14,6 +14,14 @@ class CanastaHelper
const FILA_HEADER = "Tipo";
const ULTIMA_FILA = "TOTAL";
public static function guardarCanasta($data, $path): string
{
$nombre = $data->getClientOriginalName();
$data->move(resource_path($path), $nombre);
return $nombre;
}
public static function cargarCanasta($archivo) {
$csv = Reader::createFromPath(resource_path($archivo), 'r');
$csv->setDelimiter("|");

View File

@ -44,10 +44,7 @@ class ComprasController
'data' => 'required|file|mimes:csv,txt|max:2048',
]);
$data = $request->file('data');
$nombre = $data->getClientOriginalName();
$data->move(resource_path(self::CANASTAS_PATH), $nombre);
$nombre = CanastaHelper::guardarCanasta($request->file('data'), self::CANASTAS_PATH);
CanastaHelper::cargarCanasta(self::CANASTAS_PATH . $nombre);
return response()->json([

View File

@ -2,8 +2,6 @@
use App\Helpers\CanastaHelper;
use Illuminate\Database\Seeder;
use League\Csv\Reader;
use App\Proveedor;
class CanastaSeeder extends Seeder
{