32 lines
857 B
PHP
32 lines
857 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Http\Requests\Groups;
|
|
|
|
use App\Models\GroupPost;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreGroupPostRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user() !== null;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'type' => ['required', 'in:' . implode(',', [
|
|
GroupPost::TYPE_ANNOUNCEMENT,
|
|
GroupPost::TYPE_RELEASE,
|
|
GroupPost::TYPE_RECRUITMENT,
|
|
GroupPost::TYPE_UPDATE,
|
|
])],
|
|
'title' => ['required', 'string', 'min:2', 'max:180'],
|
|
'excerpt' => ['nullable', 'string', 'max:320'],
|
|
'content' => ['nullable', 'string', 'max:40000'],
|
|
'cover_path' => ['nullable', 'string', 'max:2048'],
|
|
];
|
|
}
|
|
} |