Implement project board status workflow

This commit is contained in:
2026-03-25 08:04:34 +01:00
parent f7a0543ea1
commit 7e767b0c6c
22 changed files with 1076 additions and 7 deletions
@@ -0,0 +1,57 @@
<?php
namespace App\Http\Requests;
use App\Models\Project;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class MoveProjectTicketRequest 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('project_id', $project->id),
],
'redirect_to' => ['required', 'string', Rule::in(['backlog', 'board'])],
];
}
public function boardColumnId(): ?int
{
$boardColumnId = $this->validated('board_column_id');
if ($boardColumnId === null || $boardColumnId === '') {
return null;
}
return (int) $boardColumnId;
}
public function redirectRouteName(): string
{
return $this->validated('redirect_to') === 'backlog'
? 'projects.backlog.index'
: 'projects.board.index';
}
}