add projet

This commit is contained in:
root
2026-03-05 12:29:37 -05:00
parent 8d1eef8ba8
commit 23b7db1107
9109 changed files with 1106501 additions and 73 deletions
+70
View File
@@ -0,0 +1,70 @@
<?php
namespace App\Http\Controllers\Api;
use Illuminate\Http\Request;
class CiRequestAdapter
{
public function __construct(protected Request $request)
{
}
public function getGet(string $key = null, $default = null)
{
if ($key === null) {
return $this->request->query->all();
}
return $this->request->query->get($key, $default);
}
public function getPost(string $key = null, $default = null)
{
if ($key === null) {
return $this->request->request->all();
}
return $this->request->request->get($key, $default);
}
public function getJSON(bool $assoc = false)
{
$content = $this->request->getContent();
if ($content === '') {
return $assoc ? [] : null;
}
return json_decode($content, $assoc);
}
public function getVar(string $key, $default = null)
{
return $this->request->input($key, $default);
}
public function getHeader(string $key)
{
return $this->request->headers->get($key);
}
public function getHeaderLine(string $key)
{
return $this->request->header($key);
}
public function getFile(string $key)
{
return $this->request->file($key);
}
public function getRawInput(): string
{
return $this->request->getContent();
}
public function all(): array
{
return array_merge(
$this->request->query->all(),
$this->request->request->all(),
$this->request->json()->all()
);
}
}