first commit

This commit is contained in:
2026-02-18 19:54:52 +07:00
commit 8e070562cb
101 changed files with 13462 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
<?php
declare(strict_types=1);
namespace App\Http\Requests;
use App\Contracts\RequestFilterInterface;
use Illuminate\Foundation\Http\FormRequest;
class IndexTaskRequest extends FormRequest implements RequestFilterInterface
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'is_done' => ['nullable', 'boolean'],
'tag' => ['nullable', 'string', 'max:50'],
'q' => ['nullable', 'string', 'max:200'],
'sort' => ['nullable', 'in:created_at,due_at'],
'order' => ['nullable', 'in:asc,desc'],
'page' => ['nullable', 'integer', 'min:1'],
'per_page' => ['nullable', 'integer', 'min:1', 'max:' . config('filters.pagination.max_per_page')],
];
}
public function filters(): array
{
return [
'is_done',
'tag',
'search',
'sort',
];
}
public function values(): array
{
return [
'is_done' => $this->filled('is_done') ? (bool)$this->input('is_done') : null,
'tag' => $this->input('tag'),
'search' => $this->input('q'),
'sort' => [
'column' => $this->input('sort'),
'direction' => $this->input('order'),
],
];
}
public function perPage(): ?int
{
return (int)$this->input('per_page');
//?? config('filters.pagination.per_page')
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreTagRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreTaskRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'title' => ['required', 'string', 'max:200'],
'is_done' => ['nullable', 'boolean'],
'due_at' => ['nullable', 'date', 'date_format:Y-m-d\TH:i:s\Z'],
'tags' => ['nullable', 'array'],
'tags.*' => ['string', 'max:50'],
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateTagRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
//
];
}
}

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateTaskRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'title' => ['sometimes', 'required', 'string', 'max:200'],
'is_done' => ['sometimes', 'boolean'],
'due_at' => ['nullable', 'date', 'date_format:Y-m-d\TH:i:s\Z'],
'tags' => ['nullable', 'array'],
'tags.*' => ['string', 'max:50'],
];
}
}