first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PublishZipVersionRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'package_file' => ['required', 'file', 'mimes:zip', 'max:51200'],
|
||||
'is_stable' => ['nullable', 'boolean'],
|
||||
'mark_as_latest' => ['nullable', 'boolean'],
|
||||
'changelog' => ['nullable', 'string'],
|
||||
'published_at' => ['nullable', 'date'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StoreCategoryRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'type' => ['required', Rule::in(['plugin', 'theme'])],
|
||||
'name' => ['required', 'string', 'max:64'],
|
||||
'slug' => ['required', 'string', 'max:64', 'regex:/^[a-z0-9-]+$/'],
|
||||
'description' => ['nullable', 'string', 'max:255'],
|
||||
'sort_order' => ['nullable', 'integer'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class StorePackageRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'type' => ['required', Rule::in(['plugin', 'theme'])],
|
||||
'slug' => ['required', 'string', 'max:64', 'regex:/^[A-Za-z][A-Za-z0-9_-]*$/'],
|
||||
'name' => ['required', 'string', 'max:128'],
|
||||
'summary' => ['nullable', 'string', 'max:255'],
|
||||
'description' => ['nullable', 'string'],
|
||||
'author' => ['nullable', 'string', 'max:64'],
|
||||
'homepage' => ['nullable', 'url', 'max:512'],
|
||||
'icon_url' => ['nullable', 'url', 'max:512'],
|
||||
'license' => ['nullable', 'string', 'max:32'],
|
||||
'status' => ['nullable', Rule::in(['draft', 'published', 'hidden', 'deprecated'])],
|
||||
'is_featured' => ['nullable', 'boolean'],
|
||||
'sort_order' => ['nullable', 'integer'],
|
||||
'categories' => ['nullable', 'array'],
|
||||
'categories.*' => ['string', 'max:64'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Admin;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreVersionRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'version' => ['required', 'string', 'max:32'],
|
||||
'changelog' => ['nullable', 'string'],
|
||||
'typecho_min' => ['nullable', 'string', 'max:16'],
|
||||
'typecho_max' => ['nullable', 'string', 'max:16'],
|
||||
'php_min' => ['nullable', 'string', 'max:16'],
|
||||
'php_max' => ['nullable', 'string', 'max:16'],
|
||||
'php_extensions' => ['nullable', 'array'],
|
||||
'php_extensions.*' => ['string', 'max:32'],
|
||||
'package_url' => ['required', 'url', 'max:1024'],
|
||||
'package_size' => ['nullable', 'integer', 'min:0'],
|
||||
'sha256' => ['required', 'string', 'size:64'],
|
||||
'is_stable' => ['nullable', 'boolean'],
|
||||
'published_at' => ['nullable', 'date'],
|
||||
'mark_as_latest' => ['nullable', 'boolean'],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user