Files
sibedas/app/Http/Controllers/Api/GoogleSheetController.php
2025-02-05 13:38:21 +07:00

62 lines
1.4 KiB
PHP

<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\GoogleSheetService;
use Illuminate\Http\Request;
class GoogleSheetController extends Controller
{
protected $googleSheetService;
public function __construct(GoogleSheetService $googleSheetService){
$this->googleSheetService = $googleSheetService;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data = $this->googleSheetService->getSheetData("Sheet1!A2:BB2");
$result = [
"data" => $data,
"last_row" => $this->googleSheetService->getLastRow("Sheet1"),
"header" => $this->googleSheetService->getHeader("Sheet1"),
"last_column" => $this->googleSheetService->getLastColumn("Sheet1")
];
return response()->json($result);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}