align backend auth patterns
This commit is contained in:
parent
b3266b38c8
commit
299efe0839
23 changed files with 249 additions and 142 deletions
23
backend/app/Shared/Http/RequestInput.php
Normal file
23
backend/app/Shared/Http/RequestInput.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace App\Shared\Http;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RequestInput
|
||||
{
|
||||
public function __construct(private Request $request) {}
|
||||
|
||||
public function string(string $key): ?string
|
||||
{
|
||||
$value = $this->request->input($key);
|
||||
if (is_string($value)) {
|
||||
return $value;
|
||||
}
|
||||
if (is_int($value) || is_float($value) || is_bool($value)) {
|
||||
return (string) $value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue