2019-07-19 15:23:00 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Modules\Articoli\API\v1;
|
|
|
|
|
|
|
|
use API\Interfaces\RetrieveInterface;
|
2019-07-19 16:51:52 +02:00
|
|
|
use API\Resource;
|
2019-07-19 15:23:00 +02:00
|
|
|
|
2019-07-19 16:51:52 +02:00
|
|
|
class Articoli extends Resource implements RetrieveInterface
|
2019-07-19 15:23:00 +02:00
|
|
|
{
|
|
|
|
public function retrieve($request)
|
|
|
|
{
|
|
|
|
$query = 'SELECT *,
|
|
|
|
(SELECT nome FROM mg_categorie WHERE id = mg_articoli.id_categoria) AS categoria,
|
|
|
|
(SELECT nome FROM mg_categorie WHERE id = mg_articoli.id_sottocategoria) AS sottocategoria
|
|
|
|
FROM mg_articoli WHERE attivo = 1';
|
|
|
|
|
|
|
|
return [
|
|
|
|
'query' => $query,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|