feat: paginate workshops and videos pages
This commit is contained in:
@@ -19,6 +19,16 @@ class CreateVideoRequest extends FormRequest
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
if ($this->has('order')) {
|
||||
$this->merge([
|
||||
'order' => (int) $this->order
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
@@ -29,6 +39,7 @@ class CreateVideoRequest extends FormRequest
|
||||
'duration' => 'nullable|string|max:10',
|
||||
'tags' => 'nullable|string|max:255', // nullable para não ser obrigatório
|
||||
'category_ids' => 'nullable|array|exists:categories,id', // nullable caso não selecione
|
||||
'order' => 'nullable|integer|min:0',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -47,6 +58,8 @@ class CreateVideoRequest extends FormRequest
|
||||
'thumbnail.max' => 'A thumbnail deve ter no máximo 4MB',
|
||||
'tags.max' => 'As tags devem ter no máximo 50 caracteres',
|
||||
'category_id.exists' => 'A categoria não existe',
|
||||
'order.integer' => 'O ordem deve ser um número inteiro',
|
||||
'order.min' => 'A ordem deve ser maior ou igual a 0',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class CreateWorkshopRequest extends FormRequest
|
||||
return [
|
||||
'title' => 'required|string|max:255',
|
||||
'description' => 'required|string|max:3000',
|
||||
'image' => 'required|image|mimes:jpg,jpeg,png,webp|max:2048',
|
||||
'image' => 'required|image|mimes:jpg,jpeg,png,webp|max:4000',
|
||||
'date' => 'required|date',
|
||||
'time_start' => 'required|date_format:H:i',
|
||||
'time_end' => 'required|date_format:H:i',
|
||||
@@ -38,7 +38,7 @@ class CreateWorkshopRequest extends FormRequest
|
||||
'title.max' => 'O título deve ter no máximo 255 caracteres',
|
||||
'description.max' => 'A descrição deve ter no máximo 3000 caracteres',
|
||||
'image.mimes' => 'O ficheiro deve ser do formato jpg, jpeg, png ou webp',
|
||||
'image.max' => 'A imagem deve ter no máximo 2MB',
|
||||
'image.max' => 'A imagem deve ter no máximo 4MB',
|
||||
'date.required' => 'A data é obrigatória',
|
||||
'date.date' => 'A data deve ser uma data válida',
|
||||
'time_start.required' => 'A hora de início é obrigatória',
|
||||
|
||||
@@ -19,6 +19,16 @@ class UpdateVideoRequest extends FormRequest
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
if ($this->has('order')) {
|
||||
$this->merge([
|
||||
'order' => (int) $this->order
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
@@ -30,6 +40,7 @@ class UpdateVideoRequest extends FormRequest
|
||||
'category_ids' => 'sometimes|array',
|
||||
'category_ids.*' => 'exists:categories,id',
|
||||
'is_active' => 'sometimes|boolean',
|
||||
'order' => 'sometimes|integer|min:0',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -42,6 +53,8 @@ class UpdateVideoRequest extends FormRequest
|
||||
'thumbnail.mimes' => 'O ficheiro deve ser do formato jpg, jpeg, png ou webp',
|
||||
'thumbnail.max' => 'A thumbnail deve ter no máximo 4MB',
|
||||
'category_id.exists' => 'A categoria não existe',
|
||||
'order.integer' => 'A ordem deve ser um número inteiro',
|
||||
'order.min' => 'A ordem deve ser maior ou igual a 0',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class UpdateWorkshopRequest extends FormRequest
|
||||
return [
|
||||
'title' => 'sometimes|string|max:255',
|
||||
'description' => 'sometimes|string|max:3000',
|
||||
'image' => 'sometimes|image|mimes:jpg,jpeg,png,webp|max:2048',
|
||||
'image' => 'sometimes|image|mimes:jpg,jpeg,png,webp|max:4000',
|
||||
'date' => 'sometimes|date',
|
||||
'time_start' => 'sometimes|date_format:H:i',
|
||||
'time_end' => 'sometimes|date_format:H:i',
|
||||
@@ -39,7 +39,7 @@ class UpdateWorkshopRequest extends FormRequest
|
||||
'title.max' => 'O título deve ter no máximo 255 caracteres',
|
||||
'description.max' => 'A descrição deve ter no máximo 3000 caracteres',
|
||||
'image.mimes' => 'O ficheiro deve ser do formato jpg, jpeg, png ou webp',
|
||||
'image.max' => 'A imagem deve ter no máximo 2MB',
|
||||
'image.max' => 'A imagem deve ter no máximo 4MB',
|
||||
'date.date' => 'A data deve ser uma data válida',
|
||||
'time_start.date_format' => 'A hora de início deve ser uma hora válida',
|
||||
'time_end.date_format' => 'A hora de término deve ser uma hora válida',
|
||||
|
||||
Reference in New Issue
Block a user