2025-04-27 16:38:25 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
|
|
class MicropubRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
// Validation rules
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getType(): ?string
|
|
|
|
|
{
|
|
|
|
|
if ($this->isJson()) {
|
2026-03-13 20:39:50 +00:00
|
|
|
$data = $this->json()->all();
|
2025-04-27 16:38:25 +01:00
|
|
|
|
2026-03-13 20:39:50 +00:00
|
|
|
if (isset($data['action']) && $data['action'] === 'update') {
|
|
|
|
|
return 'update';
|
2025-04-27 16:38:25 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-13 20:39:50 +00:00
|
|
|
if (isset($data['type']) && is_array($data['type'])) {
|
|
|
|
|
$type = current($data['type']);
|
|
|
|
|
if (str_starts_with($type, 'h-')) {
|
|
|
|
|
return substr($type, 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-04-27 16:38:25 +01:00
|
|
|
|
2025-08-17 11:05:38 +01:00
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-13 20:39:50 +00:00
|
|
|
return $this->input('h') ?: null;
|
2025-08-17 11:05:38 +01:00
|
|
|
}
|
2025-04-27 16:38:25 +01:00
|
|
|
}
|