Backend parkir - itcn.co.id
This commit is contained in:
63
app/Http/Controllers/Api/V1/ConfigParameter.php
Normal file
63
app/Http/Controllers/Api/V1/ConfigParameter.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\NamaPos;
|
||||
use App\Models\SoftSettings;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ConfigParameter extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
// $query = $request->query('gate');
|
||||
$query = $_GET['gate'] ?? null;
|
||||
|
||||
Log::info('Query Params:', $request->query());
|
||||
Log::info('Gate Param:', [$request->query('gate')]);
|
||||
|
||||
if (!array_key_exists('gate', $_GET)) {
|
||||
return response()->json([
|
||||
'status' => 'failed',
|
||||
'desc' => 'Parameter undefined',
|
||||
],400);
|
||||
|
||||
}
|
||||
|
||||
if ($query === '') {
|
||||
return response()->json([
|
||||
'status' => 'failed',
|
||||
'desc' => 'Parameter gate tidak boleh kosong',
|
||||
], 400);
|
||||
}
|
||||
|
||||
|
||||
$getLocation = SoftSettings::first();
|
||||
|
||||
$location = [
|
||||
'namaSoftware' => $getLocation->namasoft,
|
||||
'namaSystem' => $getLocation->namasystem,
|
||||
'LocatioName' => $getLocation->namalokasi,
|
||||
'locationAddress' => $getLocation->alamatlokasi ?? 'location Undefined',
|
||||
'CompanyName' => $getLocation->namaperusahaan,
|
||||
'merchantID' => $getLocation->cabang_lokasi,
|
||||
];
|
||||
|
||||
if($query) {
|
||||
$getPos = NamaPos::where('id', $request->query('gate'))->with('posParams','posHardware')->first();
|
||||
$location['gateDetails'] = $getPos;
|
||||
// Log::info($getPos->toSql());
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'details' => $location
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'details' => $location,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user