aa
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Codexshaper\WooCommerce\Facades\Product;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
|
||||||
class TestPaoController extends Controller
|
class TestPaoController extends Controller
|
||||||
@@ -21,4 +22,18 @@ class TestPaoController extends Controller
|
|||||||
$this->runTestPao();
|
$this->runTestPao();
|
||||||
echo "Test OK!";
|
echo "Test OK!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getProductBySku($sku)
|
||||||
|
{
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6205,3 +6205,7 @@ Route::get('/handle-article-action-pao/{id}/{action}', function ($id, $action) {
|
|||||||
return "Azione non supportata";
|
return "Azione non supportata";
|
||||||
}
|
}
|
||||||
})->name('handleArticleActionPao');
|
})->name('handleArticleActionPao');
|
||||||
|
|
||||||
|
|
||||||
|
Route::get('/product/{sku}', [TestPaoController::class, 'getProductBySku']);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user