Files
apimacro/app/Http/Controllers/TestPaoController.php

44 lines
1.0 KiB
PHP
Raw Normal View History

2024-05-16 19:27:26 +02:00
<?php
namespace App\Http\Controllers;
2024-06-15 17:28:29 +02:00
use Codexshaper\WooCommerce\Facades\Product;
2024-05-16 19:27:26 +02:00
use Illuminate\Support\Facades\Artisan;
class TestPaoController extends Controller
{
public function runTestPao()
{
try {
echo "run";
Artisan::call('product:testpao', []);
} catch (\Exception $e) {
// Log or handle the exception here
}
}
public function provapao()
{
$this->runTestPao();
echo "Test OK!";
}
2024-06-15 17:28:29 +02:00
public function getProductBySku($sku)
{
2024-06-15 17:32:00 +02:00
echo "getProductBySku:" . $sku;
/*
2024-06-15 17:28:29 +02:00
// Estrai il prodotto utilizzando il codice SKU
$product = Product::where('sku', $sku)->first();
if ($product) {
// Ritorna il prodotto trovato come JSON
return response()->json($product);
} else {
// Ritorna un errore se il prodotto non è trovato
return response()->json(['error' => 'Product not found'], 404);
2024-06-15 17:32:00 +02:00
}*/
response()->json(true);
2024-06-15 17:28:29 +02:00
}
2024-05-16 19:27:26 +02:00
}