42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Models\Project;
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
class StoreTicketStatusRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return $this->user() !== null;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
/** @var Project $project */
|
|
$project = $this->route('project');
|
|
|
|
return [
|
|
'board_column_id' => [
|
|
'nullable',
|
|
'integer',
|
|
Rule::exists('board_columns', 'id')->where(
|
|
fn ($query) => $query->where('project_id', $project->id),
|
|
),
|
|
],
|
|
'name' => ['required', 'string', 'max:255'],
|
|
];
|
|
}
|
|
}
|