Initial Laravel API import
Some checks failed
continuous-integration/drone/push Build is failing

- Complete GGZ Ecademy Laravel backend application
- RESTful API for learning products, members, filters
- Authentication and authorization system
- Database migrations and seeders
- Custom CRUD generator commands
- Email notification system
- Integration with frontend applications
This commit is contained in:
Joris Slagter
2025-12-02 17:40:21 +01:00
parent 786b6b6a78
commit df155bb13d
341 changed files with 116385 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace App\Data\Validation;
use Nette\Schema\Expect;
use Nette\Schema\Processor;
use Nette\Schema\Schema;
use Nette\Schema\ValidationException;
class NetteValidator extends Validator implements ValidatesArray
{
private Processor $schemaProcessor;
private Schema $schema;
public function __construct(Processor $schemaProcessor, Schema $schema)
{
$this->schemaProcessor = $schemaProcessor;
$this->schema = $schema;
}
public function validateArray(array $items): ValidationResult
{
try {
$this->schemaProcessor->process($this->schema, $items);
return $this->success();
} catch (ValidationException $e) {
return $this->error($e->getMessage());
}
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace App\Data\Validation;
interface ValidatesArray
{
/**
* @param mixed[] $items
* @return ValidationResult
*/
public function validateArray(array $items): ValidationResult;
}

View File

@@ -0,0 +1,8 @@
<?php
namespace App\Data\Validation;
class ValidationException extends \Exception
{
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Data\Validation;
class ValidationResult
{
private bool $error;
private ?string $errorMessage;
public function __construct(bool $error, ?string $errorMessage = null)
{
$this->error = $error;
$this->errorMessage = $errorMessage;
}
/**
* @return void|never
*/
final public function assertIsSuccess(): void
{
if ($this->isError()) {
throw new ValidationException($this->getErrorMessage());
}
}
public function isError(): bool
{
return $this->error;
}
public function isSuccess(): bool
{
return !$this->isError();
}
public function getErrorMessage(): ?string
{
return $this->errorMessage;
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace App\Data\Validation;
abstract class Validator
{
protected function error(string $message): ValidationResult
{
return new ValidationResult(true, $message);
}
protected function success(): ValidationResult
{
return new ValidationResult(false);
}
}