Tstore/app/Http/Requests/Admin/StorePackageRequest.php

35 lines
1.2 KiB
PHP

<?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'],
];
}
}