Compare commits
3 Commits
ec5b6c8b8b
...
devel
| Author | SHA1 | Date | |
|---|---|---|---|
| dec89c2098 | |||
|
|
4120662b12 | ||
| 6163d8a5bd |
@@ -39,7 +39,7 @@ class CategorieController extends Controller
|
|||||||
|
|
||||||
public function apiList()
|
public function apiList()
|
||||||
{
|
{
|
||||||
$categorie=Categorie::list();
|
$categorie=Categorie::listCategorieAPI();
|
||||||
return json_encode($categorie);
|
return json_encode($categorie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class TagController extends Controller
|
|||||||
|
|
||||||
public function apiList()
|
public function apiList()
|
||||||
{
|
{
|
||||||
$tags=tag::getList();
|
$tags=tag::getApiList();
|
||||||
return json_encode($tags);
|
return json_encode($tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ class Categorie extends Model
|
|||||||
{
|
{
|
||||||
return self::all();
|
return self::all();
|
||||||
}
|
}
|
||||||
|
public static function listCategorieAPI()
|
||||||
|
{
|
||||||
|
return self::select('cat_name')->pluck('cat_name');
|
||||||
|
}
|
||||||
public static function listSpesa()
|
public static function listSpesa()
|
||||||
{
|
{
|
||||||
return DB::table('categories')->where('cat_uscita','=',1)->orderBy('cat_name')->get();
|
return DB::table('categories')->where('cat_uscita','=',1)->orderBy('cat_name')->get();
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ JOIN tags as t ON a.mov_fk_tags=t.id
|
|||||||
JOIN categories as c ON a.mov_fk_categoria=c.id';
|
JOIN categories as c ON a.mov_fk_categoria=c.id';
|
||||||
|
|
||||||
public static function getList() {
|
public static function getList() {
|
||||||
|
|
||||||
|
|
||||||
return DB::select(DB::raw(
|
return DB::select(DB::raw(
|
||||||
'SELECT
|
'SELECT
|
||||||
a.id,
|
a.id,
|
||||||
@@ -191,7 +191,7 @@ JOIN categories as c ON a.mov_fk_categoria=c.id';
|
|||||||
if($line['Data valuta'])
|
if($line['Data valuta'])
|
||||||
{
|
{
|
||||||
self::insEntrata([
|
self::insEntrata([
|
||||||
'mov_data'=>$line['Data valuta'],
|
'mov_data'=>self::dateFormat(0,$line['Data valuta']),
|
||||||
'mov_fk_categoria'=>1,
|
'mov_fk_categoria'=>1,
|
||||||
'mov_descrizione'=>$line['Descrizione operazione'],
|
'mov_descrizione'=>$line['Descrizione operazione'],
|
||||||
'mov_importo'=>trim(str_replace(',','.',(str_replace('.','',str_replace('€', '', $line['Importo']))))),
|
'mov_importo'=>trim(str_replace(',','.',(str_replace('.','',str_replace('€', '', $line['Importo']))))),
|
||||||
@@ -214,7 +214,8 @@ JOIN categories as c ON a.mov_fk_categoria=c.id';
|
|||||||
if($line['DARE']<>'')
|
if($line['DARE']<>'')
|
||||||
{
|
{
|
||||||
$dati=[
|
$dati=[
|
||||||
'mov_data'=>self::dateFormat(0,$line['VALUTA']), // date_format(date_create($movimento->mov_data),'d/m/Y'
|
'mov_data'=>self::dateFormat(0,$line['VALUTA']),
|
||||||
|
// date_format(date_create($movimento->mov_data),'d/m/Y'
|
||||||
// 'mov_data'=>date_format(date_create($line['VALUTA']),'Y-m-d'),
|
// 'mov_data'=>date_format(date_create($line['VALUTA']),'Y-m-d'),
|
||||||
'mov_fk_categoria'=>1,
|
'mov_fk_categoria'=>1,
|
||||||
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
|
'mov_descrizione'=>$line['DESCRIZIONE OPERAZIONE'],
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ class tag extends Model
|
|||||||
return DB::table('tags')->orderBy('tag_name')->get();
|
return DB::table('tags')->orderBy('tag_name')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getApiList()
|
||||||
|
{
|
||||||
|
return self::select('tag_name')->pluck('tag_name');
|
||||||
|
}
|
||||||
|
|
||||||
public static function inserisci($param) {
|
public static function inserisci($param) {
|
||||||
DB::table('tags')->insert(['tag_name'=> $param['tag_name']]);
|
DB::table('tags')->insert(['tag_name'=> $param['tag_name']]);
|
||||||
}
|
}
|
||||||
|
|||||||
1500
composer.lock
generated
1500
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,9 @@ Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Route::group(['middleware'=>['permission:api']], function(){
|
Route::group(['middleware'=>['permission:api']], function(){
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
Route::get('cat', [CategorieController::class,'apiList']);
|
Route::get('cat', [CategorieController::class,'apiList']);
|
||||||
Route::get('tags', [TagController::class,'apiList']);
|
Route::get('tags', [TagController::class,'apiList']);
|
||||||
Route::get('mov', [MovimentiController::class,'apiList']);
|
Route::get('mov', [MovimentiController::class,'apiList']);
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user