From 0e11d6370da50e71ca4a65df7e6ff7e71cf763b3 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Sat, 6 Jul 2024 09:41:20 -0700 Subject: [PATCH] GH-14 (#15) GH-14 --- .github/workflows/ci.yml | 129 +++-- .gitignore | 14 +- composer.json | 5 +- config/playground-matrix-resource.php | 100 +++- ..._01_02_100001_create_matrix_tags_table.php | 160 ------ ...02_100001_create_matrix_backlogs_table.php | 52 +- ...1_02_100001_create_matrix_boards_table.php | 52 +- ...01_02_100001_create_matrix_epics_table.php | 50 +- ...1_02_100001_create_matrix_flows_table.php} | 85 ++- ...2_100001_create_matrix_matrices_table.php} | 83 ++- ..._100001_create_matrix_milestones_table.php | 52 +- ...01_02_100001_create_matrix_notes_table.php | 126 +++++ ...02_100001_create_matrix_projects_table.php | 54 +- ...02_100001_create_matrix_releases_table.php | 57 +- ...02_100001_create_matrix_roadmaps_table.php | 55 +- ...02_100001_create_matrix_sources_table.php} | 61 ++- ..._02_100001_create_matrix_sprints_table.php | 50 +- ..._01_02_100001_create_matrix_tags_table.php | 120 +++++ ...01_02_100001_create_matrix_teams_table.php | 59 +-- ..._02_100001_create_matrix_tickets_table.php | 64 ++- ...2_100001_create_matrix_versions_table.php} | 66 +-- phpstan.neon.dist | 3 +- phpunit-ci.xml | 76 +++ phpunit.xml.dev | 8 +- phpunit.xml.dist | 3 +- resources/views/backlog/form-info.blade.php | 21 +- resources/views/board/form-info.blade.php | 17 +- resources/views/epic/form-info.blade.php | 17 +- resources/views/flow/form-info.blade.php | 17 +- resources/views/milestone/form-info.blade.php | 17 +- resources/views/note/form-info.blade.php | 17 +- resources/views/project/form-info.blade.php | 17 +- resources/views/release/form-info.blade.php | 17 +- resources/views/roadmap/form-info.blade.php | 17 +- resources/views/source/form-info.blade.php | 17 +- resources/views/sprint/form-info.blade.php | 17 +- resources/views/tag/form-info.blade.php | 17 +- resources/views/team/form-info.blade.php | 17 +- resources/views/ticket/form-info.blade.php | 17 +- resources/views/version/form-info.blade.php | 17 +- routes/backlogs.php | 17 +- routes/boards.php | 17 +- routes/epics.php | 17 +- routes/flows.php | 17 +- routes/matrices.php | 109 ++++ routes/matrix.php | 7 +- routes/milestones.php | 17 +- routes/notes.php | 17 +- routes/projects.php | 17 +- routes/releases.php | 17 +- routes/roadmaps.php | 17 +- routes/sources.php | 17 +- routes/sprints.php | 17 +- routes/tags.php | 17 +- routes/teams.php | 17 +- routes/tickets.php | 17 +- routes/versions.php | 17 +- src/Http/Controllers/BacklogController.php | 209 +++++--- src/Http/Controllers/BoardController.php | 210 +++++--- src/Http/Controllers/Controller.php | 19 +- src/Http/Controllers/EpicController.php | 210 +++++--- src/Http/Controllers/FlowController.php | 210 +++++--- src/Http/Controllers/IndexController.php | 4 +- src/Http/Controllers/MatrixController.php | 492 ++++++++++++++++++ src/Http/Controllers/MilestoneController.php | 210 +++++--- src/Http/Controllers/NoteController.php | 210 +++++--- src/Http/Controllers/ProjectController.php | 210 +++++--- src/Http/Controllers/ReleaseController.php | 210 +++++--- src/Http/Controllers/RoadmapController.php | 210 +++++--- src/Http/Controllers/SourceController.php | 210 +++++--- src/Http/Controllers/SprintController.php | 210 +++++--- src/Http/Controllers/TagController.php | 210 +++++--- src/Http/Controllers/TeamController.php | 210 +++++--- src/Http/Controllers/TicketController.php | 215 +++++--- src/Http/Controllers/VersionController.php | 210 +++++--- src/Http/Requests/Backlog/CreateRequest.php | 17 +- src/Http/Requests/Backlog/DestroyRequest.php | 4 +- src/Http/Requests/Backlog/EditRequest.php | 17 +- src/Http/Requests/Backlog/IndexRequest.php | 39 +- src/Http/Requests/Backlog/LockRequest.php | 4 +- src/Http/Requests/Backlog/RestoreRequest.php | 4 +- src/Http/Requests/Backlog/ShowRequest.php | 4 +- src/Http/Requests/Backlog/StoreRequest.php | 54 +- src/Http/Requests/Backlog/UnlockRequest.php | 4 +- src/Http/Requests/Backlog/UpdateRequest.php | 54 +- src/Http/Requests/Board/CreateRequest.php | 81 +-- src/Http/Requests/Board/DestroyRequest.php | 4 +- src/Http/Requests/Board/EditRequest.php | 81 +-- src/Http/Requests/Board/IndexRequest.php | 185 +++++-- src/Http/Requests/Board/LockRequest.php | 4 +- src/Http/Requests/Board/RestoreRequest.php | 4 +- src/Http/Requests/Board/ShowRequest.php | 4 +- src/Http/Requests/Board/StoreRequest.php | 116 ++--- src/Http/Requests/Board/UnlockRequest.php | 4 +- src/Http/Requests/Board/UpdateRequest.php | 116 ++--- src/Http/Requests/Epic/CreateRequest.php | 87 ++-- src/Http/Requests/Epic/DestroyRequest.php | 4 +- src/Http/Requests/Epic/EditRequest.php | 87 ++-- src/Http/Requests/Epic/IndexRequest.php | 183 +++++-- src/Http/Requests/Epic/LockRequest.php | 4 +- src/Http/Requests/Epic/RestoreRequest.php | 4 +- src/Http/Requests/Epic/ShowRequest.php | 4 +- src/Http/Requests/Epic/StoreRequest.php | 122 +++-- src/Http/Requests/Epic/UnlockRequest.php | 4 +- src/Http/Requests/Epic/UpdateRequest.php | 122 +++-- src/Http/Requests/Flow/CreateRequest.php | 72 +-- src/Http/Requests/Flow/DestroyRequest.php | 4 +- src/Http/Requests/Flow/EditRequest.php | 72 +-- src/Http/Requests/Flow/IndexRequest.php | 149 ++++-- src/Http/Requests/Flow/LockRequest.php | 4 +- src/Http/Requests/Flow/RestoreRequest.php | 4 +- src/Http/Requests/Flow/ShowRequest.php | 4 +- src/Http/Requests/Flow/StoreRequest.php | 107 ++-- src/Http/Requests/Flow/UnlockRequest.php | 4 +- src/Http/Requests/Flow/UpdateRequest.php | 107 ++-- src/Http/Requests/FormRequest.php | 6 +- src/Http/Requests/Index/IndexRequest.php | 16 + src/Http/Requests/Matrix/CreateRequest.php | 89 ++++ src/Http/Requests/Matrix/DestroyRequest.php | 40 ++ src/Http/Requests/Matrix/EditRequest.php | 89 ++++ src/Http/Requests/Matrix/IndexRequest.php | 154 ++++++ src/Http/Requests/Matrix/LockRequest.php | 22 + src/Http/Requests/Matrix/RestoreRequest.php | 22 + src/Http/Requests/Matrix/ShowRequest.php | 16 + src/Http/Requests/Matrix/StoreRequest.php | 110 ++++ src/Http/Requests/Matrix/UnlockRequest.php | 22 + src/Http/Requests/Matrix/UpdateRequest.php | 110 ++++ src/Http/Requests/Milestone/CreateRequest.php | 84 +-- .../Requests/Milestone/DestroyRequest.php | 4 +- src/Http/Requests/Milestone/EditRequest.php | 84 +-- src/Http/Requests/Milestone/IndexRequest.php | 182 +++++-- src/Http/Requests/Milestone/LockRequest.php | 4 +- .../Requests/Milestone/RestoreRequest.php | 4 +- src/Http/Requests/Milestone/ShowRequest.php | 4 +- src/Http/Requests/Milestone/StoreRequest.php | 119 ++--- src/Http/Requests/Milestone/UnlockRequest.php | 4 +- src/Http/Requests/Milestone/UpdateRequest.php | 119 ++--- src/Http/Requests/Note/CreateRequest.php | 69 ++- src/Http/Requests/Note/DestroyRequest.php | 4 +- src/Http/Requests/Note/EditRequest.php | 69 ++- src/Http/Requests/Note/IndexRequest.php | 138 +++-- src/Http/Requests/Note/LockRequest.php | 4 +- src/Http/Requests/Note/RestoreRequest.php | 4 +- src/Http/Requests/Note/ShowRequest.php | 4 +- src/Http/Requests/Note/StoreRequest.php | 104 ++-- src/Http/Requests/Note/UnlockRequest.php | 4 +- src/Http/Requests/Note/UpdateRequest.php | 104 ++-- src/Http/Requests/Project/CreateRequest.php | 86 +-- src/Http/Requests/Project/DestroyRequest.php | 4 +- src/Http/Requests/Project/EditRequest.php | 86 +-- src/Http/Requests/Project/IndexRequest.php | 189 +++++-- src/Http/Requests/Project/LockRequest.php | 4 +- src/Http/Requests/Project/RestoreRequest.php | 4 +- src/Http/Requests/Project/ShowRequest.php | 4 +- src/Http/Requests/Project/StoreRequest.php | 121 ++--- src/Http/Requests/Project/UnlockRequest.php | 4 +- src/Http/Requests/Project/UpdateRequest.php | 121 ++--- src/Http/Requests/Release/CreateRequest.php | 82 +-- src/Http/Requests/Release/DestroyRequest.php | 4 +- src/Http/Requests/Release/EditRequest.php | 82 +-- src/Http/Requests/Release/IndexRequest.php | 184 +++++-- src/Http/Requests/Release/LockRequest.php | 4 +- src/Http/Requests/Release/RestoreRequest.php | 4 +- src/Http/Requests/Release/ShowRequest.php | 4 +- src/Http/Requests/Release/StoreRequest.php | 117 ++--- src/Http/Requests/Release/UnlockRequest.php | 4 +- src/Http/Requests/Release/UpdateRequest.php | 117 ++--- src/Http/Requests/Roadmap/CreateRequest.php | 82 +-- src/Http/Requests/Roadmap/DestroyRequest.php | 4 +- src/Http/Requests/Roadmap/EditRequest.php | 82 +-- src/Http/Requests/Roadmap/IndexRequest.php | 184 +++++-- src/Http/Requests/Roadmap/LockRequest.php | 4 +- src/Http/Requests/Roadmap/RestoreRequest.php | 4 +- src/Http/Requests/Roadmap/ShowRequest.php | 4 +- src/Http/Requests/Roadmap/StoreRequest.php | 117 ++--- src/Http/Requests/Roadmap/UnlockRequest.php | 4 +- src/Http/Requests/Roadmap/UpdateRequest.php | 117 ++--- src/Http/Requests/Source/CreateRequest.php | 92 ++-- src/Http/Requests/Source/DestroyRequest.php | 4 +- src/Http/Requests/Source/EditRequest.php | 92 ++-- src/Http/Requests/Source/IndexRequest.php | 156 ++++-- src/Http/Requests/Source/LockRequest.php | 4 +- src/Http/Requests/Source/RestoreRequest.php | 4 +- src/Http/Requests/Source/ShowRequest.php | 4 +- src/Http/Requests/Source/StoreRequest.php | 127 ++--- src/Http/Requests/Source/UnlockRequest.php | 4 +- src/Http/Requests/Source/UpdateRequest.php | 127 ++--- src/Http/Requests/Sprint/CreateRequest.php | 86 +-- src/Http/Requests/Sprint/DestroyRequest.php | 4 +- src/Http/Requests/Sprint/EditRequest.php | 86 +-- src/Http/Requests/Sprint/IndexRequest.php | 184 +++++-- src/Http/Requests/Sprint/LockRequest.php | 4 +- src/Http/Requests/Sprint/RestoreRequest.php | 4 +- src/Http/Requests/Sprint/ShowRequest.php | 4 +- src/Http/Requests/Sprint/StoreRequest.php | 121 ++--- src/Http/Requests/Sprint/UnlockRequest.php | 4 +- src/Http/Requests/Sprint/UpdateRequest.php | 121 ++--- src/Http/Requests/Tag/CreateRequest.php | 81 +-- src/Http/Requests/Tag/DestroyRequest.php | 4 +- src/Http/Requests/Tag/EditRequest.php | 81 +-- src/Http/Requests/Tag/IndexRequest.php | 149 +++--- src/Http/Requests/Tag/LockRequest.php | 4 +- src/Http/Requests/Tag/RestoreRequest.php | 4 +- src/Http/Requests/Tag/ShowRequest.php | 4 +- src/Http/Requests/Tag/StoreRequest.php | 116 ++--- src/Http/Requests/Tag/UnlockRequest.php | 4 +- src/Http/Requests/Tag/UpdateRequest.php | 116 ++--- src/Http/Requests/Team/CreateRequest.php | 79 +-- src/Http/Requests/Team/DestroyRequest.php | 4 +- src/Http/Requests/Team/EditRequest.php | 79 +-- src/Http/Requests/Team/IndexRequest.php | 184 +++++-- src/Http/Requests/Team/LockRequest.php | 4 +- src/Http/Requests/Team/RestoreRequest.php | 4 +- src/Http/Requests/Team/ShowRequest.php | 4 +- src/Http/Requests/Team/StoreRequest.php | 114 ++-- src/Http/Requests/Team/UnlockRequest.php | 4 +- src/Http/Requests/Team/UpdateRequest.php | 114 ++-- src/Http/Requests/Ticket/CreateRequest.php | 29 +- src/Http/Requests/Ticket/DestroyRequest.php | 4 +- src/Http/Requests/Ticket/EditRequest.php | 29 +- src/Http/Requests/Ticket/IndexRequest.php | 52 +- src/Http/Requests/Ticket/LockRequest.php | 4 +- src/Http/Requests/Ticket/RestoreRequest.php | 4 +- src/Http/Requests/Ticket/ShowRequest.php | 4 +- src/Http/Requests/Ticket/StoreRequest.php | 100 ++-- src/Http/Requests/Ticket/UnlockRequest.php | 4 +- src/Http/Requests/Ticket/UpdateRequest.php | 100 ++-- src/Http/Requests/Version/CreateRequest.php | 81 +-- src/Http/Requests/Version/DestroyRequest.php | 4 +- src/Http/Requests/Version/EditRequest.php | 81 +-- src/Http/Requests/Version/IndexRequest.php | 150 +++--- src/Http/Requests/Version/LockRequest.php | 4 +- src/Http/Requests/Version/RestoreRequest.php | 4 +- src/Http/Requests/Version/ShowRequest.php | 4 +- src/Http/Requests/Version/StoreRequest.php | 116 ++--- src/Http/Requests/Version/UnlockRequest.php | 4 +- src/Http/Requests/Version/UpdateRequest.php | 116 ++--- src/Http/Resources/Backlog.php | 16 +- src/Http/Resources/BacklogCollection.php | 16 +- src/Http/Resources/Board.php | 16 +- src/Http/Resources/BoardCollection.php | 16 +- src/Http/Resources/Epic.php | 16 +- src/Http/Resources/EpicCollection.php | 16 +- src/Http/Resources/Flow.php | 16 +- src/Http/Resources/FlowCollection.php | 16 +- src/Http/Resources/Matrix.php | 43 ++ src/Http/Resources/MatrixCollection.php | 41 ++ src/Http/Resources/Milestone.php | 16 +- src/Http/Resources/MilestoneCollection.php | 16 +- src/Http/Resources/Note.php | 16 +- src/Http/Resources/NoteCollection.php | 16 +- src/Http/Resources/Project.php | 16 +- src/Http/Resources/ProjectCollection.php | 16 +- src/Http/Resources/Release.php | 16 +- src/Http/Resources/ReleaseCollection.php | 16 +- src/Http/Resources/Roadmap.php | 16 +- src/Http/Resources/RoadmapCollection.php | 16 +- src/Http/Resources/Source.php | 16 +- src/Http/Resources/SourceCollection.php | 16 +- src/Http/Resources/Sprint.php | 16 +- src/Http/Resources/SprintCollection.php | 16 +- src/Http/Resources/Tag.php | 16 +- src/Http/Resources/TagCollection.php | 16 +- src/Http/Resources/Team.php | 16 +- src/Http/Resources/TeamCollection.php | 16 +- src/Http/Resources/Ticket.php | 16 +- src/Http/Resources/TicketCollection.php | 16 +- src/Http/Resources/Version.php | 16 +- src/Http/Resources/VersionCollection.php | 16 +- src/Policies/BacklogPolicy.php | 4 +- src/Policies/BoardPolicy.php | 4 +- src/Policies/EpicPolicy.php | 4 +- src/Policies/FlowPolicy.php | 4 +- src/Policies/MatrixPolicy.php | 39 ++ src/Policies/MilestonePolicy.php | 4 +- src/Policies/NotePolicy.php | 4 +- src/Policies/ProjectPolicy.php | 4 +- src/Policies/ReleasePolicy.php | 4 +- src/Policies/RoadmapPolicy.php | 4 +- src/Policies/SourcePolicy.php | 4 +- src/Policies/SprintPolicy.php | 4 +- src/Policies/TagPolicy.php | 4 +- src/Policies/TeamPolicy.php | 4 +- src/Policies/TicketPolicy.php | 4 +- src/Policies/VersionPolicy.php | 4 +- src/ServiceProvider.php | 56 +- .../Http/Controllers/BacklogTestCase.php | 44 +- .../Http/Controllers/BoardTestCase.php | 44 +- .../Feature/Http/Controllers/EpicTestCase.php | 46 +- .../Feature/Http/Controllers/FlowTestCase.php | 77 +-- .../Http/Controllers/MatrixTestCase.php | 134 +++++ .../Http/Controllers/MilestoneTestCase.php | 46 +- .../Feature/Http/Controllers/NoteTestCase.php | 83 ++- .../Playground/BacklogRouteTest.php | 4 +- .../Controllers/Playground/BoardRouteTest.php | 4 +- .../Controllers/Playground/EpicRouteTest.php | 4 +- .../Controllers/Playground/FlowRouteTest.php | 4 +- .../Controllers/Playground/IndexRouteTest.php | 47 ++ .../Playground/MilestoneRouteTest.php | 4 +- .../Controllers/Playground/NoteRouteTest.php | 4 +- .../Playground/ProjectRouteTest.php | 4 +- .../Playground/ReleaseRouteTest.php | 4 +- .../Playground/RoadmapRouteTest.php | 4 +- .../Playground/SourceRouteTest.php | 4 +- .../Playground/SprintRouteTest.php | 4 +- .../Controllers/Playground/TagRouteTest.php | 4 +- .../Controllers/Playground/TeamRouteTest.php | 4 +- .../Http/Controllers/Playground/TestTrait.php | 66 --- .../Playground/TicketRouteTest.php | 151 +++++- .../Playground/VersionRouteTest.php | 4 +- .../Http/Controllers/ProjectTestCase.php | 54 +- .../Http/Controllers/ReleaseTestCase.php | 50 +- .../Http/Controllers/RoadmapTestCase.php | 50 +- .../Http/Controllers/SourceTestCase.php | 66 ++- .../Http/Controllers/SprintTestCase.php | 44 +- .../Feature/Http/Controllers/TagTestCase.php | 87 ++-- .../Feature/Http/Controllers/TeamTestCase.php | 53 +- tests/Feature/Http/Controllers/TestCase.php | 14 +- .../Http/Controllers/TicketTestCase.php | 68 ++- .../Http/Controllers/VersionTestCase.php | 87 ++-- tests/Feature/TestCase.php | 62 ++- .../Requests/Backlog/CreateRequestTest.php | 9 +- tests/Unit/Http/Requests/RequestTestCase.php | 8 +- tests/Unit/PackageProviders.php | 27 + .../Policies/BacklogPolicy/PolicyTest.php | 15 +- .../Unit/Policies/BoardPolicy/PolicyTest.php | 25 + tests/Unit/Policies/EpicPolicy/PolicyTest.php | 25 + tests/Unit/Policies/FlowPolicy/PolicyTest.php | 25 + .../Unit/Policies/MatrixPolicy/PolicyTest.php | 25 + .../Policies/MilestonePolicy/PolicyTest.php | 25 + tests/Unit/Policies/NotePolicy/PolicyTest.php | 25 + .../Policies/ProjectPolicy/PolicyTest.php | 25 + .../Policies/ReleasePolicy/PolicyTest.php | 25 + .../Policies/RoadmapPolicy/PolicyTest.php | 25 + .../Unit/Policies/SourcePolicy/PolicyTest.php | 25 + .../Unit/Policies/SprintPolicy/PolicyTest.php | 25 + tests/Unit/Policies/TagPolicy/PolicyTest.php | 25 + tests/Unit/Policies/TeamPolicy/PolicyTest.php | 25 + .../Unit/Policies/TicketPolicy/PolicyTest.php | 25 + .../Policies/VersionPolicy/PolicyTest.php | 25 + tests/Unit/ServiceProvider/InstanceTest.php | 102 ++++ tests/Unit/TestCase.php | 6 +- tests/Unit/TestTrait.php | 56 -- 343 files changed, 10885 insertions(+), 6606 deletions(-) delete mode 100644 database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_tags_table.php rename database/{migrations-matrix-uuid => migrations-package}/2020_01_02_100001_create_matrix_backlogs_table.php (80%) rename database/{migrations-matrix-uuid => migrations-package}/2020_01_02_100001_create_matrix_boards_table.php (81%) rename database/{migrations-matrix-uuid => migrations-package}/2020_01_02_100001_create_matrix_epics_table.php (81%) rename database/{migrations-matrix-uuid/2020_01_02_100001_create_matrix_sources_table.php => migrations-package/2020_01_02_100001_create_matrix_flows_table.php} (59%) rename database/{migrations-matrix-uuid/2020_01_02_100001_create_matrix_versions_table.php => migrations-package/2020_01_02_100001_create_matrix_matrices_table.php} (55%) rename database/{migrations-matrix-uuid => migrations-package}/2020_01_02_100001_create_matrix_milestones_table.php (81%) create mode 100644 database/migrations-package/2020_01_02_100001_create_matrix_notes_table.php rename database/{migrations-matrix-uuid => migrations-package}/2020_01_02_100001_create_matrix_projects_table.php (79%) rename database/{migrations-matrix-uuid => migrations-package}/2020_01_02_100001_create_matrix_releases_table.php (80%) rename database/{migrations-matrix-uuid => migrations-package}/2020_01_02_100001_create_matrix_roadmaps_table.php (79%) rename database/{migrations-matrix-uuid/2020_01_02_100001_create_matrix_flows_table.php => migrations-package/2020_01_02_100001_create_matrix_sources_table.php} (72%) rename database/{migrations-matrix-uuid => migrations-package}/2020_01_02_100001_create_matrix_sprints_table.php (81%) create mode 100644 database/migrations-package/2020_01_02_100001_create_matrix_tags_table.php rename database/{migrations-matrix-uuid => migrations-package}/2020_01_02_100001_create_matrix_teams_table.php (75%) rename database/{migrations-matrix-uuid => migrations-package}/2020_01_02_100001_create_matrix_tickets_table.php (78%) rename database/{migrations-matrix-uuid/2020_01_02_100001_create_matrix_notes_table.php => migrations-package/2020_01_02_100001_create_matrix_versions_table.php} (70%) create mode 100644 phpunit-ci.xml create mode 100644 routes/matrices.php create mode 100644 src/Http/Controllers/MatrixController.php create mode 100644 src/Http/Requests/Index/IndexRequest.php create mode 100644 src/Http/Requests/Matrix/CreateRequest.php create mode 100644 src/Http/Requests/Matrix/DestroyRequest.php create mode 100644 src/Http/Requests/Matrix/EditRequest.php create mode 100644 src/Http/Requests/Matrix/IndexRequest.php create mode 100644 src/Http/Requests/Matrix/LockRequest.php create mode 100644 src/Http/Requests/Matrix/RestoreRequest.php create mode 100644 src/Http/Requests/Matrix/ShowRequest.php create mode 100644 src/Http/Requests/Matrix/StoreRequest.php create mode 100644 src/Http/Requests/Matrix/UnlockRequest.php create mode 100644 src/Http/Requests/Matrix/UpdateRequest.php create mode 100644 src/Http/Resources/Matrix.php create mode 100644 src/Http/Resources/MatrixCollection.php create mode 100644 src/Policies/MatrixPolicy.php create mode 100644 tests/Feature/Http/Controllers/MatrixTestCase.php create mode 100644 tests/Feature/Http/Controllers/Playground/IndexRouteTest.php delete mode 100644 tests/Feature/Http/Controllers/Playground/TestTrait.php create mode 100644 tests/Unit/PackageProviders.php create mode 100644 tests/Unit/Policies/BoardPolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/EpicPolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/FlowPolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/MatrixPolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/MilestonePolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/NotePolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/ProjectPolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/ReleasePolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/RoadmapPolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/SourcePolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/SprintPolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/TagPolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/TeamPolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/TicketPolicy/PolicyTest.php create mode 100644 tests/Unit/Policies/VersionPolicy/PolicyTest.php create mode 100644 tests/Unit/ServiceProvider/InstanceTest.php delete mode 100644 tests/Unit/TestTrait.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05f35e4..7bee9c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: 'CI' +name: "CI" on: push: @@ -30,9 +30,9 @@ jobs: echo "TIMESTAMP_START=$(date +'%s')" >> $GITHUB_OUTPUT - name: "Slack notification: IN PROGRESS" id: slack - uses: slackapi/slack-github-action@v1.25.0 + uses: slackapi/slack-github-action@v1.26.0 with: - channel-id: 'C068A06PV43' + channel-id: "C068A06PV43" payload: | { "text": "CI Build Status for playground-matrix-resource: IN PROGRESS\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", @@ -49,11 +49,11 @@ jobs: "fields": [ { "type": "mrkdwn", - "text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}" + "text": "*Start:* " }, { "type": "mrkdwn", - "text": "*End:*\n--" + "text": "*End:* --" } ] }, @@ -71,18 +71,25 @@ jobs: ] }, { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*PR:* ${{ github.event.pull_request.html_url || github.event.head_commit.url }}" - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Build:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - } + "type": "actions", + "elements": [ + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Merge/Pull Request" + }, + "url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + }, + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Build: ${{ github.run_id }}" + }, + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + } + ] } ] } @@ -102,16 +109,16 @@ jobs: version: "11.0" php_version: "8.2" php_extensions: intl xdebug + configuration: phpunit-ci.xml coverage_clover: clover.xml coverage_text: true - memory_limit: "256M" - name: Make code coverage badge uses: timkrase/phpunit-coverage-badge@v1.2.1 with: coverage_badge_path: output/coverage.svg push_badge: false - name: Git push to testing/develop branch - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: publish_dir: ./output publish_branch: testing/develop @@ -122,7 +129,8 @@ jobs: with: level: 9 php_version: "8.2" - path: config/ routes/ src/ tests/Feature/ resources/views/ + path: config/ src/ tests/Feature/ tests/Unit/ + args: --verbose --debug - name: Stopping timer if: ${{ !cancelled() }} id: timer_end @@ -131,10 +139,11 @@ jobs: run: | echo "DATE_END=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT echo "DURATION_PHRASE=$(($(date +'%s')-$TIMESTAMP_START)) seconds" >> $GITHUB_OUTPUT + echo "TIMESTAMP_END=$(date +'%s')" >> $GITHUB_OUTPUT - name: "Slack notification: Done" - uses: slackapi/slack-github-action@v1.25.0 + uses: slackapi/slack-github-action@v1.26.0 with: - channel-id: 'C068A06PV43' + channel-id: "C068A06PV43" update-ts: ${{ steps.slack.outputs.ts }} payload: | { @@ -152,11 +161,11 @@ jobs: "fields": [ { "type": "mrkdwn", - "text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}" + "text": "*Start:* " }, { "type": "mrkdwn", - "text": "*End:*\n${{ steps.timer_end.outputs.DATE_END }}" + "text": "*End:* " } ] }, @@ -174,18 +183,26 @@ jobs: ] }, { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*PR:* ${{ github.event.pull_request.html_url || github.event.head_commit.url }}" - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Build:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - } + "type": "actions", + "elements": [ + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Merge/Pull Request" + }, + "url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + }, + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Build: ${{ github.run_id }}" + }, + "style": "primary", + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + } + ] } ] } @@ -193,9 +210,9 @@ jobs: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - name: "Send a notification for failures" if: ${{ failure() }} - uses: slackapi/slack-github-action@v1.25.0 + uses: slackapi/slack-github-action@v1.26.0 with: - channel-id: 'C068A06PV43' + channel-id: "C068A06PV43" update-ts: ${{ steps.slack.outputs.ts }} payload: | { @@ -213,11 +230,11 @@ jobs: "fields": [ { "type": "mrkdwn", - "text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}" + "text": "*Start:* " }, { "type": "mrkdwn", - "text": "*End:*\n${{ steps.timer_end.outputs.DATE_END }}" + "text": "*End:* " } ] }, @@ -235,18 +252,26 @@ jobs: ] }, { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*PR:* ${{ github.event.pull_request.html_url || github.event.head_commit.url }}" - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Build:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - } + "type": "actions", + "elements": [ + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Merge/Pull Request" + }, + "url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + }, + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Build: ${{ github.run_id }}" + }, + "style": "danger", + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + } + ] } ] } diff --git a/.gitignore b/.gitignore index bc1c93d..69d39db 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ .DS_Store */.DS_Store -.derp +*.derp Homestead.yaml Homestead.json @@ -22,10 +22,6 @@ Homestead.json /hide -resources/packages - -composer.lock - /tmp /components /vendor @@ -34,15 +30,15 @@ nbproject/private/ database/migrations/*.disabled -*.derp +resources/packages + +composer.lock tmp-* temp-* .php-cs-fixer.cache -package-lock.json - ################################################################################ # Environment ignores ################################################################################ @@ -67,6 +63,8 @@ public/tests phpunit.xml +phpstan.neon + .phpunit.cache tests/_output/* diff --git a/composer.json b/composer.json index d6c1cfa..2202389 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,8 @@ "preferred-install": { "gammamatrix/*": "source", "*": "dist" - } + }, + "process-timeout": 0 }, "extra": { "branch-alias": { @@ -64,7 +65,7 @@ } }, "scripts": { - "test": "vendor/bin/phpunit", + "test": "vendor/bin/testbench package:test", "format": "vendor/bin/php-cs-fixer fix", "analyse": "vendor/bin/phpstan analyse --verbose --debug --level max" } diff --git a/config/playground-matrix-resource.php b/config/playground-matrix-resource.php index c984ed8..592d27a 100644 --- a/config/playground-matrix-resource.php +++ b/config/playground-matrix-resource.php @@ -1,18 +1,72 @@ (bool) env('PLAYGROUND_MATRIX_RESOURCE_ABOUT', true), + + /* + |--------------------------------------------------------------------------- + | Loading + |--------------------------------------------------------------------------- + | + | By default, translations and views are loaded. + | + */ + + 'load' => [ + 'policies' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_POLICIES', true), + 'routes' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_ROUTES', true), + 'translations' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_TRANSLATIONS', false), + 'views' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_VIEWS', true), + ], + + /* + |--------------------------------------------------------------------------- + | Middleware + |--------------------------------------------------------------------------- + | + | + */ + 'middleware' => [ 'default' => env('PLAYGROUND_MATRIX_RESOURCE_MIDDLEWARE_DEFAULT', ['web']), 'auth' => env('PLAYGROUND_MATRIX_RESOURCE_MIDDLEWARE_AUTH', ['web', 'auth']), 'guest' => env('PLAYGROUND_MATRIX_RESOURCE_MIDDLEWARE_GUEST', ['web']), ], + + /* + |--------------------------------------------------------------------------- + | Policies + |--------------------------------------------------------------------------- + | + | + */ + 'policies' => [ Playground\Matrix\Models\Backlog::class => Playground\Matrix\Resource\Policies\BacklogPolicy::class, Playground\Matrix\Models\Board::class => Playground\Matrix\Resource\Policies\BoardPolicy::class, Playground\Matrix\Models\Epic::class => Playground\Matrix\Resource\Policies\EpicPolicy::class, Playground\Matrix\Models\Flow::class => Playground\Matrix\Resource\Policies\FlowPolicy::class, + Playground\Matrix\Models\Matrix::class => Playground\Matrix\Resource\Policies\MatrixPolicy::class, Playground\Matrix\Models\Milestone::class => Playground\Matrix\Resource\Policies\MilestonePolicy::class, Playground\Matrix\Models\Note::class => Playground\Matrix\Resource\Policies\NotePolicy::class, Playground\Matrix\Models\Project::class => Playground\Matrix\Resource\Policies\ProjectPolicy::class, @@ -25,17 +79,22 @@ Playground\Matrix\Models\Ticket::class => Playground\Matrix\Resource\Policies\TicketPolicy::class, Playground\Matrix\Models\Version::class => Playground\Matrix\Resource\Policies\VersionPolicy::class, ], - 'load' => [ - 'policies' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_POLICIES', true), - 'routes' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_ROUTES', true), - 'views' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_VIEWS', true), - ], + + /* + |--------------------------------------------------------------------------- + | Routes + |--------------------------------------------------------------------------- + | + | + */ + 'routes' => [ 'matrix' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_MATRIX', true), 'backlogs' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_BACKLOGS', true), 'boards' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_BOARDS', true), 'epics' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_EPICS', true), 'flows' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_FLOWS', true), + 'matrices' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_MATRICES', true), 'milestones' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_MILESTONES', true), 'notes' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_NOTES', true), 'projects' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_PROJECTS', true), @@ -48,14 +107,40 @@ 'tickets' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_TICKETS', true), 'versions' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_VERSIONS', true), ], + + /* + |--------------------------------------------------------------------------- + | Sitemap + |--------------------------------------------------------------------------- + | + | + */ + 'sitemap' => [ 'enable' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_SITEMAP_ENABLE', true), 'guest' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_SITEMAP_GUEST', true), 'user' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_SITEMAP_USER', true), 'view' => env('PLAYGROUND_MATRIX_RESOURCE_SITEMAP_VIEW', 'playground-matrix-resource::sitemap'), ], + + /* + |--------------------------------------------------------------------------- + | Templates + |--------------------------------------------------------------------------- + | + | + */ + 'blade' => env('PLAYGROUND_MATRIX_RESOURCE_BLADE', 'playground-matrix-resource::'), + /* + |-------------------------------------------------------------------------- + | Abilities + |-------------------------------------------------------------------------- + | + | + */ + 'abilities' => [ 'admin' => [ 'playground-matrix-resource:*', @@ -65,6 +150,7 @@ 'playground-matrix-resource:board:*', 'playground-matrix-resource:epic:*', 'playground-matrix-resource:flow:*', + 'playground-matrix-resource:matrix:*', 'playground-matrix-resource:milestone:*', 'playground-matrix-resource:note:*', 'playground-matrix-resource:project:*', @@ -86,6 +172,8 @@ 'playground-matrix-resource:epic:viewAny', 'playground-matrix-resource:flow:view', 'playground-matrix-resource:flow:viewAny', + 'playground-matrix-resource:matrix:view', + 'playground-matrix-resource:matrix:viewAny', 'playground-matrix-resource:milestone:view', 'playground-matrix-resource:milestone:viewAny', 'playground-matrix-resource:note:view', @@ -132,6 +220,8 @@ // 'playground-matrix-resource:epic:viewAny', // 'playground-matrix-resource:flow:view', // 'playground-matrix-resource:flow:viewAny', + // 'playground-matrix-resource:matrix:view', + // 'playground-matrix-resource:matrix:viewAny', // 'playground-matrix-resource:milestone:view', // 'playground-matrix-resource:milestone:viewAny', // 'playground-matrix-resource:note:view', diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_tags_table.php b/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_tags_table.php deleted file mode 100644 index 3072c6f..0000000 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_tags_table.php +++ /dev/null @@ -1,160 +0,0 @@ -uuid('id')->primary(); - - // IDs - - $table->uuid('created_by_id')->nullable()->index(); - $table->uuid('modified_by_id')->nullable()->index(); - $table->uuid('owned_by_id')->nullable()->index(); - $table->uuid('parent_id')->nullable()->index(); - $table->string('tag_type')->nullable()->index(); - $table->uuid('backlog_id')->nullable()->index(); - $table->uuid('board_id')->nullable()->index(); - $table->uuid('epic_id')->nullable()->index(); - $table->uuid('flow_id')->nullable()->index(); - $table->uuid('milestone_id')->nullable()->index(); - $table->uuid('note_id')->nullable()->index(); - $table->uuid('project_id')->nullable()->index(); - $table->uuid('release_id')->nullable()->index(); - $table->uuid('roadmap_id')->nullable()->index(); - $table->uuid('source_id')->nullable()->index(); - $table->uuid('sprint_id')->nullable()->index(); - $table->uuid('team_id')->nullable()->index(); - $table->uuid('ticket_id')->nullable()->index(); - $table->uuid('version_id')->nullable()->index(); - - // Dates - - $table->timestamps(); - - $table->softDeletes(); - - $table->dateTime('start_at')->nullable()->index(); - $table->dateTime('planned_start_at')->nullable(); - $table->dateTime('end_at')->nullable()->index(); - $table->dateTime('planned_end_at')->nullable(); - $table->dateTime('canceled_at')->nullable(); - $table->dateTime('closed_at')->nullable()->index(); - $table->dateTime('embargo_at')->nullable(); - $table->dateTime('fixed_at')->nullable(); - $table->dateTime('postponed_at')->nullable(); - $table->dateTime('published_at')->nullable(); - $table->dateTime('released_at')->nullable(); - $table->dateTime('resumed_at')->nullable(); - $table->dateTime('resolved_at')->nullable()->index(); - $table->dateTime('suspended_at')->nullable(); - - // Permissions - - $table->bigInteger('gids')->default(0)->unsigned(); - $table->tinyInteger('po')->default(0)->unsigned(); - $table->tinyInteger('pg')->default(0)->unsigned(); - $table->tinyInteger('pw')->default(0)->unsigned(); - $table->boolean('only_admin')->default(0); - $table->boolean('only_user')->default(0); - $table->boolean('only_guest')->default(0); - $table->boolean('allow_public')->default(0); - - // Status - - $table->bigInteger('status')->default(0)->unsigned(); - $table->bigInteger('rank')->default(0); - $table->bigInteger('size')->default(0); - - // Matrix - - $table->string('matrix')->default(''); - $table->bigInteger('x')->nullable(); - $table->bigInteger('y')->nullable(); - $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); - - // Flags - - $table->boolean('active')->default(1)->index(); - $table->boolean('canceled')->default(0); - $table->boolean('closed')->default(0); - $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); - $table->boolean('fixed')->default(0); - $table->boolean('flagged')->default(0); - $table->boolean('internal')->default(0); - $table->boolean('locked')->default(0); - $table->boolean('pending')->default(0); - $table->boolean('planned')->default(0); - $table->boolean('problem')->default(0); - $table->boolean('published')->default(0); - $table->boolean('released')->default(0); - $table->boolean('retired')->default(0); - $table->boolean('resolved')->default(0); - $table->boolean('suspended')->default(0); - $table->boolean('unknown')->default(0); - - // Strings - - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); - $table->mediumText('content')->nullable(); - $table->mediumText('summary')->nullable(); - - // UI - - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); - $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); - - // JSON - - $table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('backlog')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('board')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('flow')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); - $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('roadmap')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('matrix_tags'); - } -}; diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_backlogs_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_backlogs_table.php similarity index 80% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_backlogs_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_backlogs_table.php index 873ef8c..32403e4 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_backlogs_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_backlogs_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -32,6 +36,7 @@ public function up(): void $table->uuid('board_id')->nullable()->index(); $table->uuid('epic_id')->nullable()->index(); $table->uuid('flow_id')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); $table->uuid('milestone_id')->nullable()->index(); $table->uuid('note_id')->nullable()->index(); $table->uuid('project_id')->nullable()->index(); @@ -84,17 +89,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -102,6 +107,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -109,31 +115,33 @@ public function up(): void $table->boolean('locked')->default(0); $table->boolean('pending')->default(0); $table->boolean('planned')->default(0); + $table->boolean('prioritized')->default(0); $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); $table->boolean('retired')->default(0); $table->boolean('resolved')->default(0); + $table->boolean('special')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_boards_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_boards_table.php similarity index 81% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_boards_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_boards_table.php index 0fcc963..883da40 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_boards_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_boards_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -28,10 +32,11 @@ public function up(): void $table->uuid('modified_by_id')->nullable()->index(); $table->uuid('owned_by_id')->nullable()->index(); $table->uuid('parent_id')->nullable()->index(); - $table->string('board_type')->nullable()->index(); $table->uuid('backlog_id')->nullable()->index(); + $table->string('board_type')->nullable()->index(); $table->uuid('epic_id')->nullable()->index(); $table->uuid('flow_id')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); $table->uuid('milestone_id')->nullable()->index(); $table->uuid('note_id')->nullable()->index(); $table->uuid('project_id')->nullable()->index(); @@ -84,17 +89,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -102,6 +107,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -117,23 +123,23 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_epics_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_epics_table.php similarity index 81% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_epics_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_epics_table.php index 7ad4336..1c0b96b 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_epics_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_epics_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -32,6 +36,7 @@ public function up(): void $table->uuid('backlog_id')->nullable()->index(); $table->uuid('board_id')->nullable()->index(); $table->uuid('flow_id')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); $table->uuid('milestone_id')->nullable()->index(); $table->uuid('note_id')->nullable()->index(); $table->uuid('project_id')->nullable()->index(); @@ -84,17 +89,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -102,6 +107,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -117,23 +123,23 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_sources_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_flows_table.php similarity index 59% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_sources_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_flows_table.php index 598c74b..292766e 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_sources_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_flows_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -28,21 +32,11 @@ public function up(): void $table->uuid('modified_by_id')->nullable()->index(); $table->uuid('owned_by_id')->nullable()->index(); $table->uuid('parent_id')->nullable()->index(); - $table->string('source_type')->nullable()->index(); - $table->uuid('backlog_id')->nullable()->index(); - $table->uuid('board_id')->nullable()->index(); - $table->uuid('epic_id')->nullable()->index(); - $table->uuid('flow_id')->nullable()->index(); - $table->uuid('milestone_id')->nullable()->index(); + $table->string('flow_type')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); $table->uuid('note_id')->nullable()->index(); - $table->uuid('project_id')->nullable()->index(); - $table->uuid('release_id')->nullable()->index(); - $table->uuid('roadmap_id')->nullable()->index(); - $table->uuid('sprint_id')->nullable()->index(); $table->uuid('tag_id')->nullable()->index(); $table->uuid('team_id')->nullable()->index(); - $table->uuid('ticket_id')->nullable()->index(); - $table->uuid('version_id')->nullable()->index(); // Dates @@ -54,15 +48,9 @@ public function up(): void $table->dateTime('planned_start_at')->nullable(); $table->dateTime('end_at')->nullable()->index(); $table->dateTime('planned_end_at')->nullable(); - $table->dateTime('canceled_at')->nullable(); - $table->dateTime('closed_at')->nullable()->index(); $table->dateTime('embargo_at')->nullable(); - $table->dateTime('fixed_at')->nullable(); $table->dateTime('postponed_at')->nullable(); - $table->dateTime('published_at')->nullable(); - $table->dateTime('released_at')->nullable(); $table->dateTime('resumed_at')->nullable(); - $table->dateTime('resolved_at')->nullable()->index(); $table->dateTime('suspended_at')->nullable(); // Permissions @@ -84,67 +72,60 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags $table->boolean('active')->default(1)->index(); - $table->boolean('canceled')->default(0); - $table->boolean('closed')->default(0); - $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); - $table->boolean('fixed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); $table->boolean('pending')->default(0); $table->boolean('planned')->default(0); $table->boolean('problem')->default(0); - $table->boolean('published')->default(0); - $table->boolean('released')->default(0); $table->boolean('retired')->default(0); - $table->boolean('resolved')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON $table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('backlog')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('board')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('flow')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('backlog')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('board')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('roadmap')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); }); @@ -155,6 +136,6 @@ public function up(): void */ public function down(): void { - Schema::dropIfExists('matrix_sources'); + Schema::dropIfExists('matrix_flows'); } }; diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_versions_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_matrices_table.php similarity index 55% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_versions_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_matrices_table.php index 46313cb..c548447 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_versions_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_matrices_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -28,21 +32,8 @@ public function up(): void $table->uuid('modified_by_id')->nullable()->index(); $table->uuid('owned_by_id')->nullable()->index(); $table->uuid('parent_id')->nullable()->index(); - $table->string('version_type')->nullable()->index(); - $table->uuid('backlog_id')->nullable()->index(); - $table->uuid('board_id')->nullable()->index(); - $table->uuid('epic_id')->nullable()->index(); - $table->uuid('flow_id')->nullable()->index(); - $table->uuid('milestone_id')->nullable()->index(); - $table->uuid('note_id')->nullable()->index(); - $table->uuid('project_id')->nullable()->index(); - $table->uuid('release_id')->nullable()->index(); - $table->uuid('roadmap_id')->nullable()->index(); - $table->uuid('source_id')->nullable()->index(); - $table->uuid('sprint_id')->nullable()->index(); - $table->uuid('tag_id')->nullable()->index(); - $table->uuid('team_id')->nullable()->index(); - $table->uuid('ticket_id')->nullable()->index(); + $table->string('matrix_type')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); // Dates @@ -57,12 +48,8 @@ public function up(): void $table->dateTime('canceled_at')->nullable(); $table->dateTime('closed_at')->nullable()->index(); $table->dateTime('embargo_at')->nullable(); - $table->dateTime('fixed_at')->nullable(); $table->dateTime('postponed_at')->nullable(); - $table->dateTime('published_at')->nullable(); - $table->dateTime('released_at')->nullable(); $table->dateTime('resumed_at')->nullable(); - $table->dateTime('resolved_at')->nullable()->index(); $table->dateTime('suspended_at')->nullable(); // Permissions @@ -84,17 +71,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -102,50 +89,42 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); - $table->boolean('fixed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); $table->boolean('pending')->default(0); $table->boolean('planned')->default(0); $table->boolean('problem')->default(0); - $table->boolean('published')->default(0); - $table->boolean('released')->default(0); $table->boolean('retired')->default(0); - $table->boolean('resolved')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON $table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('backlog')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('board')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('flow')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('roadmap')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); }); } @@ -155,6 +134,6 @@ public function up(): void */ public function down(): void { - Schema::dropIfExists('matrix_versions'); + Schema::dropIfExists('matrix_matrices'); } }; diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_milestones_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_milestones_table.php similarity index 81% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_milestones_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_milestones_table.php index ea85e7d..a959018 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_milestones_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_milestones_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -33,6 +37,7 @@ public function up(): void $table->uuid('board_id')->nullable()->index(); $table->uuid('epic_id')->nullable()->index(); $table->uuid('flow_id')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); $table->uuid('note_id')->nullable()->index(); $table->uuid('project_id')->nullable()->index(); $table->uuid('release_id')->nullable()->index(); @@ -61,8 +66,8 @@ public function up(): void $table->dateTime('postponed_at')->nullable(); $table->dateTime('published_at')->nullable(); $table->dateTime('released_at')->nullable(); - $table->dateTime('resumed_at')->nullable(); $table->dateTime('resolved_at')->nullable()->index(); + $table->dateTime('resumed_at')->nullable(); $table->dateTime('suspended_at')->nullable(); // Permissions @@ -84,17 +89,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -102,6 +107,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -117,23 +123,23 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations-package/2020_01_02_100001_create_matrix_notes_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_notes_table.php new file mode 100644 index 0000000..2bf60fa --- /dev/null +++ b/database/migrations-package/2020_01_02_100001_create_matrix_notes_table.php @@ -0,0 +1,126 @@ +uuid('id')->primary(); + + // IDs + + $table->uuid('created_by_id')->nullable()->index(); + $table->uuid('modified_by_id')->nullable()->index(); + $table->uuid('owned_by_id')->nullable()->index(); + $table->uuid('parent_id')->nullable()->index(); + $table->string('note_type')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); + $table->uuid('tag_id')->nullable()->index(); + + // Dates + + $table->timestamps(); + + $table->softDeletes(); + + // Permissions + + $table->bigInteger('gids')->default(0)->unsigned(); + $table->tinyInteger('po')->default(0)->unsigned(); + $table->tinyInteger('pg')->default(0)->unsigned(); + $table->tinyInteger('pw')->default(0)->unsigned(); + $table->boolean('only_admin')->default(0); + $table->boolean('only_user')->default(0); + $table->boolean('only_guest')->default(0); + $table->boolean('allow_public')->default(0); + + // Status + + $table->bigInteger('status')->default(0)->unsigned(); + $table->bigInteger('rank')->default(0); + $table->bigInteger('size')->default(0); + + // Matrix + + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->bigInteger('x')->nullable(); + $table->bigInteger('y')->nullable(); + $table->bigInteger('z')->nullable(); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); + + // Flags + + $table->boolean('active')->default(1)->index(); + $table->boolean('canceled')->default(0); + $table->boolean('closed')->default(0); + $table->boolean('completed')->default(0); + $table->boolean('flagged')->default(0); + $table->boolean('internal')->default(0); + $table->boolean('locked')->default(0); + $table->boolean('pending')->default(0); + $table->boolean('planned')->default(0); + $table->boolean('problem')->default(0); + $table->boolean('unknown')->default(0); + + // Columns + + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); + $table->mediumText('content')->nullable(); + $table->mediumText('summary')->nullable(); + + // Ui + + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); + $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); + + // JSON + + $table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); + $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('matrix_notes'); + } +}; diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_projects_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_projects_table.php similarity index 79% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_projects_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_projects_table.php index 848712f..ed6b18e 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_projects_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_projects_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -33,6 +37,7 @@ public function up(): void $table->uuid('board_id')->nullable()->index(); $table->uuid('epic_id')->nullable()->index(); $table->uuid('flow_id')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); $table->uuid('milestone_id')->nullable()->index(); $table->uuid('note_id')->nullable()->index(); $table->uuid('release_id')->nullable()->index(); @@ -57,7 +62,6 @@ public function up(): void $table->dateTime('canceled_at')->nullable(); $table->dateTime('closed_at')->nullable()->index(); $table->dateTime('embargo_at')->nullable(); - $table->dateTime('fixed_at')->nullable(); $table->dateTime('postponed_at')->nullable(); $table->dateTime('published_at')->nullable(); $table->dateTime('released_at')->nullable(); @@ -84,17 +88,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -102,6 +106,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -117,23 +122,25 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); + $table->string('key', 32)->nullable()->index(); + $table->string('code_name', 128)->nullable()->index(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON @@ -142,6 +149,7 @@ public function up(): void $table->json('backlog')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('board')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('flow')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('history')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_releases_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_releases_table.php similarity index 80% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_releases_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_releases_table.php index 0538ff1..f38ef51 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_releases_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_releases_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -33,6 +37,7 @@ public function up(): void $table->uuid('board_id')->nullable()->index(); $table->uuid('epic_id')->nullable()->index(); $table->uuid('flow_id')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); $table->uuid('milestone_id')->nullable()->index(); $table->uuid('note_id')->nullable()->index(); $table->uuid('project_id')->nullable()->index(); @@ -61,8 +66,8 @@ public function up(): void $table->dateTime('postponed_at')->nullable(); $table->dateTime('published_at')->nullable(); $table->dateTime('released_at')->nullable(); + $table->dateTime('resolved_at')->nullable(); $table->dateTime('resumed_at')->nullable(); - $table->dateTime('resolved_at')->nullable()->index(); $table->dateTime('suspended_at')->nullable(); // Permissions @@ -84,17 +89,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -102,9 +107,9 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); - $table->boolean('fixed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('flagged')->default(0); + $table->boolean('fixed')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); $table->boolean('pending')->default(0); @@ -112,28 +117,28 @@ public function up(): void $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); - $table->boolean('retired')->default(0); $table->boolean('resolved')->default(0); + $table->boolean('retired')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_roadmaps_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_roadmaps_table.php similarity index 79% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_roadmaps_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_roadmaps_table.php index e042b61..62f479a 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_roadmaps_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_roadmaps_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -33,6 +37,7 @@ public function up(): void $table->uuid('board_id')->nullable()->index(); $table->uuid('epic_id')->nullable()->index(); $table->uuid('flow_id')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); $table->uuid('milestone_id')->nullable()->index(); $table->uuid('note_id')->nullable()->index(); $table->uuid('project_id')->nullable()->index(); @@ -57,12 +62,10 @@ public function up(): void $table->dateTime('canceled_at')->nullable(); $table->dateTime('closed_at')->nullable()->index(); $table->dateTime('embargo_at')->nullable(); - $table->dateTime('fixed_at')->nullable(); $table->dateTime('postponed_at')->nullable(); $table->dateTime('published_at')->nullable(); $table->dateTime('released_at')->nullable(); $table->dateTime('resumed_at')->nullable(); - $table->dateTime('resolved_at')->nullable()->index(); $table->dateTime('suspended_at')->nullable(); // Permissions @@ -84,17 +87,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -102,8 +105,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); - $table->boolean('fixed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); @@ -112,28 +114,27 @@ public function up(): void $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); - $table->boolean('retired')->default(0); $table->boolean('resolved')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_flows_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_sources_table.php similarity index 72% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_flows_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_sources_table.php index 00ac43d..f9a54ce 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_flows_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_sources_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -28,8 +32,8 @@ public function up(): void $table->uuid('modified_by_id')->nullable()->index(); $table->uuid('owned_by_id')->nullable()->index(); $table->uuid('parent_id')->nullable()->index(); - $table->string('flow_type')->nullable()->index(); - $table->uuid('note_id')->nullable()->index(); + $table->string('source_type')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); $table->uuid('tag_id')->nullable()->index(); $table->uuid('team_id')->nullable()->index(); @@ -50,8 +54,8 @@ public function up(): void $table->dateTime('postponed_at')->nullable(); $table->dateTime('published_at')->nullable(); $table->dateTime('released_at')->nullable(); - $table->dateTime('resolved_at')->nullable(); $table->dateTime('resumed_at')->nullable(); + $table->dateTime('resolved_at')->nullable()->index(); $table->dateTime('suspended_at')->nullable(); // Permissions @@ -73,17 +77,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -91,6 +95,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -106,32 +111,32 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON $table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('flow')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); }); } @@ -140,6 +145,6 @@ public function up(): void */ public function down(): void { - Schema::dropIfExists('matrix_flows'); + Schema::dropIfExists('matrix_sources'); } }; diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_sprints_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_sprints_table.php similarity index 81% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_sprints_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_sprints_table.php index 03e5c42..3936cc0 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_sprints_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_sprints_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -33,6 +37,7 @@ public function up(): void $table->uuid('board_id')->nullable()->index(); $table->uuid('epic_id')->nullable()->index(); $table->uuid('flow_id')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); $table->uuid('milestone_id')->nullable()->index(); $table->uuid('note_id')->nullable()->index(); $table->uuid('project_id')->nullable()->index(); @@ -84,17 +89,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -102,6 +107,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -117,23 +123,23 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations-package/2020_01_02_100001_create_matrix_tags_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_tags_table.php new file mode 100644 index 0000000..b3caa09 --- /dev/null +++ b/database/migrations-package/2020_01_02_100001_create_matrix_tags_table.php @@ -0,0 +1,120 @@ +uuid('id')->primary(); + + // IDs + + $table->uuid('created_by_id')->nullable()->index(); + $table->uuid('modified_by_id')->nullable()->index(); + $table->uuid('owned_by_id')->nullable()->index(); + $table->uuid('parent_id')->nullable()->index(); + $table->string('tag_type')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); + + // Dates + + $table->timestamps(); + + $table->softDeletes(); + + // Permissions + + $table->bigInteger('gids')->default(0)->unsigned(); + $table->tinyInteger('po')->default(0)->unsigned(); + $table->tinyInteger('pg')->default(0)->unsigned(); + $table->tinyInteger('pw')->default(0)->unsigned(); + $table->boolean('only_admin')->default(0); + $table->boolean('only_user')->default(0); + $table->boolean('only_guest')->default(0); + $table->boolean('allow_public')->default(0); + + // Status + + $table->bigInteger('status')->default(0)->unsigned(); + $table->bigInteger('rank')->default(0); + $table->bigInteger('size')->default(0); + + // Matrix + + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->bigInteger('x')->nullable(); + $table->bigInteger('y')->nullable(); + $table->bigInteger('z')->nullable(); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); + + // Flags + + $table->boolean('active')->default(1)->index(); + $table->boolean('flagged')->default(0); + $table->boolean('internal')->default(0); + $table->boolean('locked')->default(0); + $table->boolean('retired')->default(0); + $table->boolean('unknown')->default(0); + + // Columns + + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); + $table->mediumText('content')->nullable(); + $table->mediumText('summary')->nullable(); + + // Ui + + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); + $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); + + // JSON + + $table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); + $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); + $table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('matrix_tags'); + } +}; diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_teams_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_teams_table.php similarity index 75% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_teams_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_teams_table.php index cb16a2c..7fe3c62 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_teams_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_teams_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -33,6 +37,7 @@ public function up(): void $table->uuid('board_id')->nullable()->index(); $table->uuid('epic_id')->nullable()->index(); $table->uuid('flow_id')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); $table->uuid('milestone_id')->nullable()->index(); $table->uuid('note_id')->nullable()->index(); $table->uuid('project_id')->nullable()->index(); @@ -57,12 +62,8 @@ public function up(): void $table->dateTime('canceled_at')->nullable(); $table->dateTime('closed_at')->nullable()->index(); $table->dateTime('embargo_at')->nullable(); - $table->dateTime('fixed_at')->nullable(); $table->dateTime('postponed_at')->nullable(); - $table->dateTime('published_at')->nullable(); - $table->dateTime('released_at')->nullable(); $table->dateTime('resumed_at')->nullable(); - $table->dateTime('resolved_at')->nullable()->index(); $table->dateTime('suspended_at')->nullable(); // Permissions @@ -84,17 +85,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -102,38 +103,34 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); - $table->boolean('fixed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); $table->boolean('locked')->default(0); $table->boolean('pending')->default(0); $table->boolean('planned')->default(0); $table->boolean('problem')->default(0); - $table->boolean('published')->default(0); - $table->boolean('released')->default(0); $table->boolean('retired')->default(0); - $table->boolean('resolved')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_tickets_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_tickets_table.php similarity index 78% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_tickets_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_tickets_table.php index 24c6b3a..5352dfd 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_tickets_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_tickets_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -34,7 +38,9 @@ public function up(): void $table->uuid('board_id')->nullable()->index(); $table->uuid('completed_by_id')->nullable()->index(); $table->uuid('epic_id')->nullable()->index(); + $table->uuid('fixed_by_id')->nullable()->index(); $table->uuid('flow_id')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); $table->uuid('milestone_id')->nullable()->index(); $table->uuid('note_id')->nullable()->index(); $table->uuid('project_id')->nullable()->index(); @@ -88,17 +94,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -106,6 +112,7 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); + $table->boolean('cron')->default(0)->index(); $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); @@ -113,29 +120,31 @@ public function up(): void $table->boolean('locked')->default(0); $table->boolean('pending')->default(0); $table->boolean('planned')->default(0); + $table->boolean('prioritized')->default(0); $table->boolean('problem')->default(0); $table->boolean('published')->default(0); $table->boolean('released')->default(0); $table->boolean('retired')->default(0); $table->boolean('resolved')->default(0); + $table->boolean('special')->default(0); $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - $table->string('key')->default(''); $table->string('handler')->default(''); - $table->bigInteger('code')->default(0)->unsigned()->index(); - $table->string('key_code_hash')->default(''); + $table->string('key', 32)->nullable()->index(); + $table->bigInteger('code')->nullable()->unsigned()->index(); + $table->string('key_code_hash')->nullable(); $table->string('priority')->default(''); $table->string('severity')->default(''); $table->string('resolution')->default(''); @@ -143,15 +152,18 @@ public function up(): void $table->string('state')->default(''); $table->string('workflow_type')->default(''); $table->tinyInteger('points')->default(0)->unsigned(); + $table->mediumText('actual')->nullable(); + $table->mediumText('expected')->nullable(); $table->mediumText('story')->nullable(); + $table->mediumText('steps')->nullable(); $table->mediumText('criteria')->nullable(); - $table->decimal('reproducibility', 8, 2)->nullable()->default(null); + $table->decimal('reproducibility', 8, 2)->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_notes_table.php b/database/migrations-package/2020_01_02_100001_create_matrix_versions_table.php similarity index 70% rename from database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_notes_table.php rename to database/migrations-package/2020_01_02_100001_create_matrix_versions_table.php index 7cc6f0a..a4637b7 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_notes_table.php +++ b/database/migrations-package/2020_01_02_100001_create_matrix_versions_table.php @@ -1,15 +1,18 @@ uuid('id')->primary(); @@ -28,7 +32,14 @@ public function up(): void $table->uuid('modified_by_id')->nullable()->index(); $table->uuid('owned_by_id')->nullable()->index(); $table->uuid('parent_id')->nullable()->index(); - $table->string('note_type')->nullable()->index(); + $table->string('version_type')->nullable()->index(); + $table->uuid('matrix_id')->nullable()->index(); + $table->uuid('project_id')->nullable()->index(); + $table->uuid('roadmap_id')->nullable()->index(); + $table->uuid('source_id')->nullable()->index(); + $table->uuid('tag_id')->nullable()->index(); + $table->uuid('team_id')->nullable()->index(); + $table->uuid('ticket_id')->nullable()->index(); // Dates @@ -70,17 +81,17 @@ public function up(): void // Matrix - $table->string('matrix')->default(''); + $table->json('matrix')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->bigInteger('x')->nullable(); $table->bigInteger('y')->nullable(); $table->bigInteger('z')->nullable(); - $table->decimal('r', 65, 10)->nullable()->default(null); - $table->decimal('theta', 10, 6)->nullable()->default(null); - $table->decimal('rho', 10, 6)->nullable()->default(null); - $table->decimal('phi', 10, 6)->nullable()->default(null); - $table->decimal('elevation', 65, 10)->nullable()->default(null); - $table->decimal('latitude', 8, 6)->nullable()->default(null); - $table->decimal('longitude', 9, 6)->nullable()->default(null); + $table->decimal('r', 65, 10)->nullable(); + $table->decimal('theta', 10, 6)->nullable(); + $table->decimal('rho', 10, 6)->nullable(); + $table->decimal('phi', 10, 6)->nullable(); + $table->decimal('elevation', 65, 10)->nullable(); + $table->decimal('latitude', 8, 6)->nullable(); + $table->decimal('longitude', 9, 6)->nullable(); // Flags @@ -88,7 +99,6 @@ public function up(): void $table->boolean('canceled')->default(0); $table->boolean('closed')->default(0); $table->boolean('completed')->default(0); - $table->boolean('duplicate')->default(0); $table->boolean('fixed')->default(0); $table->boolean('flagged')->default(0); $table->boolean('internal')->default(0); @@ -103,35 +113,31 @@ public function up(): void $table->boolean('suspended')->default(0); $table->boolean('unknown')->default(0); - // Strings + // Columns - $table->string('label')->default(''); - $table->string('title')->default(''); - $table->string('byline')->default(''); - $table->string('slug')->nullable()->default(null)->index(); - $table->string('url')->default(''); - $table->string('description')->default(''); - $table->string('introduction')->default(''); + $table->string('label', 128)->default(''); + $table->string('title', 255)->default(''); + $table->string('byline', 255)->default(''); + $table->string('slug', 128)->nullable()->index(); + $table->string('url', 512)->default(''); + $table->string('description', 512)->default(''); + $table->string('introduction', 512)->default(''); $table->mediumText('content')->nullable(); $table->mediumText('summary')->nullable(); - // UI + // Ui - $table->string('icon')->default(''); - $table->string('image')->default(''); - $table->string('avatar')->default(''); + $table->string('icon', 128)->default(''); + $table->string('image', 512)->default(''); + $table->string('avatar', 512)->default(''); $table->json('ui')->nullable()->default(new Expression('(JSON_OBJECT())')); // JSON $table->json('assets')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('backlog')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('board')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('flow')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('meta')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('notes')->nullable()->default(new Expression('(JSON_ARRAY())'))->comment('Array of note objects'); $table->json('options')->nullable()->default(new Expression('(JSON_OBJECT())')); - $table->json('roadmap')->nullable()->default(new Expression('(JSON_OBJECT())')); $table->json('sources')->nullable()->default(new Expression('(JSON_OBJECT())')); }); } @@ -141,6 +147,6 @@ public function up(): void */ public function down(): void { - Schema::dropIfExists('matrix_notes'); + Schema::dropIfExists('matrix_versions'); } }; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 9306fea..b249ebb 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -17,4 +17,5 @@ parameters: treatPhpDocTypesAsCertain: false - checkGenericClassInNonGenericObjectType: false + # editorUrl: 'vscode://file/%%file%%:%%line%%' + # editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%' \ No newline at end of file diff --git a/phpunit-ci.xml b/phpunit-ci.xml new file mode 100644 index 0000000..6d0ae50 --- /dev/null +++ b/phpunit-ci.xml @@ -0,0 +1,76 @@ + + + + + tests/Unit + + + tests/Feature + + + + + + + + + + + + + + + + + + + + + + src + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/phpunit.xml.dev b/phpunit.xml.dev index 6913fe6..ca46d9f 100644 --- a/phpunit.xml.dev +++ b/phpunit.xml.dev @@ -40,10 +40,10 @@ - + - + @@ -58,14 +58,14 @@ - + - + diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c498c1f..4e90588 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -61,13 +61,12 @@ - - + diff --git a/resources/views/backlog/form-info.blade.php b/resources/views/backlog/form-info.blade.php index add0e01..4505f4c 100644 --- a/resources/views/backlog/form-info.blade.php +++ b/resources/views/backlog/form-info.blade.php @@ -2,22 +2,27 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> - + @if (!empty($parents)) - + @endif diff --git a/resources/views/board/form-info.blade.php b/resources/views/board/form-info.blade.php index 028cc4e..37d2f74 100644 --- a/resources/views/board/form-info.blade.php +++ b/resources/views/board/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/epic/form-info.blade.php b/resources/views/epic/form-info.blade.php index 7b00c68..f0b168f 100644 --- a/resources/views/epic/form-info.blade.php +++ b/resources/views/epic/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/flow/form-info.blade.php b/resources/views/flow/form-info.blade.php index 2997912..99f7200 100644 --- a/resources/views/flow/form-info.blade.php +++ b/resources/views/flow/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/milestone/form-info.blade.php b/resources/views/milestone/form-info.blade.php index d2077e2..8ace47e 100644 --- a/resources/views/milestone/form-info.blade.php +++ b/resources/views/milestone/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/note/form-info.blade.php b/resources/views/note/form-info.blade.php index 692758a..27f9826 100644 --- a/resources/views/note/form-info.blade.php +++ b/resources/views/note/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/project/form-info.blade.php b/resources/views/project/form-info.blade.php index 15d4e2a..c49a72d 100644 --- a/resources/views/project/form-info.blade.php +++ b/resources/views/project/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/release/form-info.blade.php b/resources/views/release/form-info.blade.php index 9698af4..ac5561d 100644 --- a/resources/views/release/form-info.blade.php +++ b/resources/views/release/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/roadmap/form-info.blade.php b/resources/views/roadmap/form-info.blade.php index 905365e..dfc4483 100644 --- a/resources/views/roadmap/form-info.blade.php +++ b/resources/views/roadmap/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/source/form-info.blade.php b/resources/views/source/form-info.blade.php index 51ebe1b..c1bf757 100644 --- a/resources/views/source/form-info.blade.php +++ b/resources/views/source/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/sprint/form-info.blade.php b/resources/views/sprint/form-info.blade.php index 24b5d3d..4774dc6 100644 --- a/resources/views/sprint/form-info.blade.php +++ b/resources/views/sprint/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/tag/form-info.blade.php b/resources/views/tag/form-info.blade.php index f74b3b2..de464ee 100644 --- a/resources/views/tag/form-info.blade.php +++ b/resources/views/tag/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/team/form-info.blade.php b/resources/views/team/form-info.blade.php index 452ba20..9a31b2f 100644 --- a/resources/views/team/form-info.blade.php +++ b/resources/views/team/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/ticket/form-info.blade.php b/resources/views/ticket/form-info.blade.php index 71a3b4f..f583cd3 100644 --- a/resources/views/ticket/form-info.blade.php +++ b/resources/views/ticket/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/resources/views/version/form-info.blade.php b/resources/views/version/form-info.blade.php index 0920d13..aea9d58 100644 --- a/resources/views/version/form-info.blade.php +++ b/resources/views/version/form-info.blade.php @@ -2,17 +2,22 @@ Information - - You should provide a label. + 'maxlength' => 255, + ]"> + You should provide a title. + + + + ]" /> diff --git a/routes/backlogs.php b/routes/backlogs.php index 7f72570..519198e 100644 --- a/routes/backlogs.php +++ b/routes/backlogs.php @@ -1,4 +1,7 @@ can('edit', 'backlog'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.backlogs.go', + // 'as' => 'playground.matrix.resource.backlogs.go', // 'uses' => 'BacklogController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'backlog'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.backlogs.slug', + // 'as' => 'playground.matrix.resource.backlogs.slug', // 'uses' => 'BacklogController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.backlogs.store', + // 'as' => 'playground.matrix.resource.backlogs.store', // 'uses' => 'BacklogController@store', - // ])->can('store', \Playground\Matrix\Models\Backlog::class); + // ])->can('store', Playground\Matrix\Models\Backlog::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Backlog::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.backlogs.put', + // 'as' => 'playground.matrix.resource.backlogs.put', // 'uses' => 'BacklogController@store', - // ])->can('store', \Playground\Matrix\Models\Backlog::class); + // ])->can('store', Playground\Matrix\Models\Backlog::class); // // Route::put('/{backlog}', [ - // 'as' => 'playground.matrix.resource.backlogs.put.id', + // 'as' => 'playground.matrix.resource.backlogs.put.id', // 'uses' => 'BacklogController@store', // ])->whereUuid('backlog')->can('update', 'backlog'); diff --git a/routes/boards.php b/routes/boards.php index a4004e3..770281d 100644 --- a/routes/boards.php +++ b/routes/boards.php @@ -1,4 +1,7 @@ can('edit', 'board'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.boards.go', + // 'as' => 'playground.matrix.resource.boards.go', // 'uses' => 'BoardController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'board'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.boards.slug', + // 'as' => 'playground.matrix.resource.boards.slug', // 'uses' => 'BoardController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.boards.store', + // 'as' => 'playground.matrix.resource.boards.store', // 'uses' => 'BoardController@store', - // ])->can('store', \Playground\Matrix\Models\Board::class); + // ])->can('store', Playground\Matrix\Models\Board::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Board::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.boards.put', + // 'as' => 'playground.matrix.resource.boards.put', // 'uses' => 'BoardController@store', - // ])->can('store', \Playground\Matrix\Models\Board::class); + // ])->can('store', Playground\Matrix\Models\Board::class); // // Route::put('/{board}', [ - // 'as' => 'playground.matrix.resource.boards.put.id', + // 'as' => 'playground.matrix.resource.boards.put.id', // 'uses' => 'BoardController@store', // ])->whereUuid('board')->can('update', 'board'); diff --git a/routes/epics.php b/routes/epics.php index e6e371b..78fcae1 100644 --- a/routes/epics.php +++ b/routes/epics.php @@ -1,4 +1,7 @@ can('edit', 'epic'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.epics.go', + // 'as' => 'playground.matrix.resource.epics.go', // 'uses' => 'EpicController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'epic'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.epics.slug', + // 'as' => 'playground.matrix.resource.epics.slug', // 'uses' => 'EpicController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.epics.store', + // 'as' => 'playground.matrix.resource.epics.store', // 'uses' => 'EpicController@store', - // ])->can('store', \Playground\Matrix\Models\Epic::class); + // ])->can('store', Playground\Matrix\Models\Epic::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Epic::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.epics.put', + // 'as' => 'playground.matrix.resource.epics.put', // 'uses' => 'EpicController@store', - // ])->can('store', \Playground\Matrix\Models\Epic::class); + // ])->can('store', Playground\Matrix\Models\Epic::class); // // Route::put('/{epic}', [ - // 'as' => 'playground.matrix.resource.epics.put.id', + // 'as' => 'playground.matrix.resource.epics.put.id', // 'uses' => 'EpicController@store', // ])->whereUuid('epic')->can('update', 'epic'); diff --git a/routes/flows.php b/routes/flows.php index 6ae3f95..2dcf904 100644 --- a/routes/flows.php +++ b/routes/flows.php @@ -1,4 +1,7 @@ can('edit', 'flow'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.flows.go', + // 'as' => 'playground.matrix.resource.flows.go', // 'uses' => 'FlowController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'flow'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.flows.slug', + // 'as' => 'playground.matrix.resource.flows.slug', // 'uses' => 'FlowController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.flows.store', + // 'as' => 'playground.matrix.resource.flows.store', // 'uses' => 'FlowController@store', - // ])->can('store', \Playground\Matrix\Models\Flow::class); + // ])->can('store', Playground\Matrix\Models\Flow::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Flow::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.flows.put', + // 'as' => 'playground.matrix.resource.flows.put', // 'uses' => 'FlowController@store', - // ])->can('store', \Playground\Matrix\Models\Flow::class); + // ])->can('store', Playground\Matrix\Models\Flow::class); // // Route::put('/{flow}', [ - // 'as' => 'playground.matrix.resource.flows.put.id', + // 'as' => 'playground.matrix.resource.flows.put.id', // 'uses' => 'FlowController@store', // ])->whereUuid('flow')->can('update', 'flow'); diff --git a/routes/matrices.php b/routes/matrices.php new file mode 100644 index 0000000..da7cdff --- /dev/null +++ b/routes/matrices.php @@ -0,0 +1,109 @@ + 'resource/matrix/matrices', + 'middleware' => config('playground-matrix-resource.middleware.default'), + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', +], function () { + Route::get('/', [ + 'as' => 'playground.matrix.resource.matrices', + 'uses' => 'MatrixController@index', + ])->can('index', Playground\Matrix\Models\Matrix::class); + + // UI + + Route::get('/create', [ + 'as' => 'playground.matrix.resource.matrices.create', + 'uses' => 'MatrixController@create', + ])->can('create', Playground\Matrix\Models\Matrix::class); + + Route::get('/edit/{matrix}', [ + 'as' => 'playground.matrix.resource.matrices.edit', + 'uses' => 'MatrixController@edit', + ])->whereUuid('matrix') + ->can('edit', 'matrix'); + + // Route::get('/go/{id}', [ + // 'as' => 'playground.matrix.resource.matrices.go', + // 'uses' => 'MatrixController@go', + // ]); + + Route::get('/{matrix}', [ + 'as' => 'playground.matrix.resource.matrices.show', + 'uses' => 'MatrixController@show', + ])->whereUuid('matrix') + ->can('detail', 'matrix'); + + // Route::get('/{slug}', [ + // 'as' => 'playground.matrix.resource.matrices.slug', + // 'uses' => 'MatrixController@slug', + // ])->where('slug', '[a-zA-Z0-9\-]+'); + + // Route::post('/store', [ + // 'as' => 'playground.matrix.resource.matrices.store', + // 'uses' => 'MatrixController@store', + // ])->can('store', Playground\Matrix\Models\Matrix::class); + + // API + + Route::put('/lock/{matrix}', [ + 'as' => 'playground.matrix.resource.matrices.lock', + 'uses' => 'MatrixController@lock', + ])->whereUuid('matrix') + ->can('lock', 'matrix'); + + Route::delete('/lock/{matrix}', [ + 'as' => 'playground.matrix.resource.matrices.unlock', + 'uses' => 'MatrixController@unlock', + ])->whereUuid('matrix') + ->can('unlock', 'matrix'); + + Route::delete('/{matrix}', [ + 'as' => 'playground.matrix.resource.matrices.destroy', + 'uses' => 'MatrixController@destroy', + ])->whereUuid('matrix') + ->can('delete', 'matrix') + ->withTrashed(); + + Route::put('/restore/{matrix}', [ + 'as' => 'playground.matrix.resource.matrices.restore', + 'uses' => 'MatrixController@restore', + ])->whereUuid('matrix') + ->can('restore', 'matrix') + ->withTrashed(); + + Route::post('/', [ + 'as' => 'playground.matrix.resource.matrices.post', + 'uses' => 'MatrixController@store', + ])->can('store', Playground\Matrix\Models\Matrix::class); + + // Route::put('/', [ + // 'as' => 'playground.matrix.resource.matrices.put', + // 'uses' => 'MatrixController@store', + // ])->can('store', Playground\Matrix\Models\Matrix::class); + // + // Route::put('/{matrix}', [ + // 'as' => 'playground.matrix.resource.matrices.put.id', + // 'uses' => 'MatrixController@store', + // ])->whereUuid('matrix')->can('update', 'matrix'); + + Route::patch('/{matrix}', [ + 'as' => 'playground.matrix.resource.matrices.patch', + 'uses' => 'MatrixController@update', + ])->whereUuid('matrix')->can('update', 'matrix'); +}); diff --git a/routes/matrix.php b/routes/matrix.php index 6c00e95..93b6d92 100644 --- a/routes/matrix.php +++ b/routes/matrix.php @@ -1,4 +1,7 @@ config('playground-matrix-resource.middleware.default'), 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { + Route::get('/', [ 'as' => 'playground.matrix.resource', 'uses' => 'IndexController@index', ])->can('view', Playground\Matrix\Models\Ticket::class); + }); diff --git a/routes/milestones.php b/routes/milestones.php index 5988697..c16e9ab 100644 --- a/routes/milestones.php +++ b/routes/milestones.php @@ -1,4 +1,7 @@ can('edit', 'milestone'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.milestones.go', + // 'as' => 'playground.matrix.resource.milestones.go', // 'uses' => 'MilestoneController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'milestone'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.milestones.slug', + // 'as' => 'playground.matrix.resource.milestones.slug', // 'uses' => 'MilestoneController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.milestones.store', + // 'as' => 'playground.matrix.resource.milestones.store', // 'uses' => 'MilestoneController@store', - // ])->can('store', \Playground\Matrix\Models\Milestone::class); + // ])->can('store', Playground\Matrix\Models\Milestone::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Milestone::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.milestones.put', + // 'as' => 'playground.matrix.resource.milestones.put', // 'uses' => 'MilestoneController@store', - // ])->can('store', \Playground\Matrix\Models\Milestone::class); + // ])->can('store', Playground\Matrix\Models\Milestone::class); // // Route::put('/{milestone}', [ - // 'as' => 'playground.matrix.resource.milestones.put.id', + // 'as' => 'playground.matrix.resource.milestones.put.id', // 'uses' => 'MilestoneController@store', // ])->whereUuid('milestone')->can('update', 'milestone'); diff --git a/routes/notes.php b/routes/notes.php index 94069ad..f1be153 100644 --- a/routes/notes.php +++ b/routes/notes.php @@ -1,4 +1,7 @@ can('edit', 'note'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.notes.go', + // 'as' => 'playground.matrix.resource.notes.go', // 'uses' => 'NoteController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'note'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.notes.slug', + // 'as' => 'playground.matrix.resource.notes.slug', // 'uses' => 'NoteController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.notes.store', + // 'as' => 'playground.matrix.resource.notes.store', // 'uses' => 'NoteController@store', - // ])->can('store', \Playground\Matrix\Models\Note::class); + // ])->can('store', Playground\Matrix\Models\Note::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Note::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.notes.put', + // 'as' => 'playground.matrix.resource.notes.put', // 'uses' => 'NoteController@store', - // ])->can('store', \Playground\Matrix\Models\Note::class); + // ])->can('store', Playground\Matrix\Models\Note::class); // // Route::put('/{note}', [ - // 'as' => 'playground.matrix.resource.notes.put.id', + // 'as' => 'playground.matrix.resource.notes.put.id', // 'uses' => 'NoteController@store', // ])->whereUuid('note')->can('update', 'note'); diff --git a/routes/projects.php b/routes/projects.php index 0f950e3..3a5f7d5 100644 --- a/routes/projects.php +++ b/routes/projects.php @@ -1,4 +1,7 @@ can('edit', 'project'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.projects.go', + // 'as' => 'playground.matrix.resource.projects.go', // 'uses' => 'ProjectController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'project'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.projects.slug', + // 'as' => 'playground.matrix.resource.projects.slug', // 'uses' => 'ProjectController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.projects.store', + // 'as' => 'playground.matrix.resource.projects.store', // 'uses' => 'ProjectController@store', - // ])->can('store', \Playground\Matrix\Models\Project::class); + // ])->can('store', Playground\Matrix\Models\Project::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Project::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.projects.put', + // 'as' => 'playground.matrix.resource.projects.put', // 'uses' => 'ProjectController@store', - // ])->can('store', \Playground\Matrix\Models\Project::class); + // ])->can('store', Playground\Matrix\Models\Project::class); // // Route::put('/{project}', [ - // 'as' => 'playground.matrix.resource.projects.put.id', + // 'as' => 'playground.matrix.resource.projects.put.id', // 'uses' => 'ProjectController@store', // ])->whereUuid('project')->can('update', 'project'); diff --git a/routes/releases.php b/routes/releases.php index e1a7684..57078f4 100644 --- a/routes/releases.php +++ b/routes/releases.php @@ -1,4 +1,7 @@ can('edit', 'release'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.releases.go', + // 'as' => 'playground.matrix.resource.releases.go', // 'uses' => 'ReleaseController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'release'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.releases.slug', + // 'as' => 'playground.matrix.resource.releases.slug', // 'uses' => 'ReleaseController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.releases.store', + // 'as' => 'playground.matrix.resource.releases.store', // 'uses' => 'ReleaseController@store', - // ])->can('store', \Playground\Matrix\Models\Release::class); + // ])->can('store', Playground\Matrix\Models\Release::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Release::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.releases.put', + // 'as' => 'playground.matrix.resource.releases.put', // 'uses' => 'ReleaseController@store', - // ])->can('store', \Playground\Matrix\Models\Release::class); + // ])->can('store', Playground\Matrix\Models\Release::class); // // Route::put('/{release}', [ - // 'as' => 'playground.matrix.resource.releases.put.id', + // 'as' => 'playground.matrix.resource.releases.put.id', // 'uses' => 'ReleaseController@store', // ])->whereUuid('release')->can('update', 'release'); diff --git a/routes/roadmaps.php b/routes/roadmaps.php index e8ce297..c8eba5b 100644 --- a/routes/roadmaps.php +++ b/routes/roadmaps.php @@ -1,4 +1,7 @@ can('edit', 'roadmap'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.roadmaps.go', + // 'as' => 'playground.matrix.resource.roadmaps.go', // 'uses' => 'RoadmapController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'roadmap'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.roadmaps.slug', + // 'as' => 'playground.matrix.resource.roadmaps.slug', // 'uses' => 'RoadmapController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.roadmaps.store', + // 'as' => 'playground.matrix.resource.roadmaps.store', // 'uses' => 'RoadmapController@store', - // ])->can('store', \Playground\Matrix\Models\Roadmap::class); + // ])->can('store', Playground\Matrix\Models\Roadmap::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Roadmap::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.roadmaps.put', + // 'as' => 'playground.matrix.resource.roadmaps.put', // 'uses' => 'RoadmapController@store', - // ])->can('store', \Playground\Matrix\Models\Roadmap::class); + // ])->can('store', Playground\Matrix\Models\Roadmap::class); // // Route::put('/{roadmap}', [ - // 'as' => 'playground.matrix.resource.roadmaps.put.id', + // 'as' => 'playground.matrix.resource.roadmaps.put.id', // 'uses' => 'RoadmapController@store', // ])->whereUuid('roadmap')->can('update', 'roadmap'); diff --git a/routes/sources.php b/routes/sources.php index 7758feb..45d9368 100644 --- a/routes/sources.php +++ b/routes/sources.php @@ -1,4 +1,7 @@ can('edit', 'source'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.sources.go', + // 'as' => 'playground.matrix.resource.sources.go', // 'uses' => 'SourceController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'source'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.sources.slug', + // 'as' => 'playground.matrix.resource.sources.slug', // 'uses' => 'SourceController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.sources.store', + // 'as' => 'playground.matrix.resource.sources.store', // 'uses' => 'SourceController@store', - // ])->can('store', \Playground\Matrix\Models\Source::class); + // ])->can('store', Playground\Matrix\Models\Source::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Source::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.sources.put', + // 'as' => 'playground.matrix.resource.sources.put', // 'uses' => 'SourceController@store', - // ])->can('store', \Playground\Matrix\Models\Source::class); + // ])->can('store', Playground\Matrix\Models\Source::class); // // Route::put('/{source}', [ - // 'as' => 'playground.matrix.resource.sources.put.id', + // 'as' => 'playground.matrix.resource.sources.put.id', // 'uses' => 'SourceController@store', // ])->whereUuid('source')->can('update', 'source'); diff --git a/routes/sprints.php b/routes/sprints.php index 1509a83..5ecf71a 100644 --- a/routes/sprints.php +++ b/routes/sprints.php @@ -1,4 +1,7 @@ can('edit', 'sprint'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.sprints.go', + // 'as' => 'playground.matrix.resource.sprints.go', // 'uses' => 'SprintController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'sprint'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.sprints.slug', + // 'as' => 'playground.matrix.resource.sprints.slug', // 'uses' => 'SprintController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.sprints.store', + // 'as' => 'playground.matrix.resource.sprints.store', // 'uses' => 'SprintController@store', - // ])->can('store', \Playground\Matrix\Models\Sprint::class); + // ])->can('store', Playground\Matrix\Models\Sprint::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Sprint::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.sprints.put', + // 'as' => 'playground.matrix.resource.sprints.put', // 'uses' => 'SprintController@store', - // ])->can('store', \Playground\Matrix\Models\Sprint::class); + // ])->can('store', Playground\Matrix\Models\Sprint::class); // // Route::put('/{sprint}', [ - // 'as' => 'playground.matrix.resource.sprints.put.id', + // 'as' => 'playground.matrix.resource.sprints.put.id', // 'uses' => 'SprintController@store', // ])->whereUuid('sprint')->can('update', 'sprint'); diff --git a/routes/tags.php b/routes/tags.php index fd1a298..03fe4b4 100644 --- a/routes/tags.php +++ b/routes/tags.php @@ -1,4 +1,7 @@ can('edit', 'tag'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.tags.go', + // 'as' => 'playground.matrix.resource.tags.go', // 'uses' => 'TagController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'tag'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.tags.slug', + // 'as' => 'playground.matrix.resource.tags.slug', // 'uses' => 'TagController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.tags.store', + // 'as' => 'playground.matrix.resource.tags.store', // 'uses' => 'TagController@store', - // ])->can('store', \Playground\Matrix\Models\Tag::class); + // ])->can('store', Playground\Matrix\Models\Tag::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Tag::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.tags.put', + // 'as' => 'playground.matrix.resource.tags.put', // 'uses' => 'TagController@store', - // ])->can('store', \Playground\Matrix\Models\Tag::class); + // ])->can('store', Playground\Matrix\Models\Tag::class); // // Route::put('/{tag}', [ - // 'as' => 'playground.matrix.resource.tags.put.id', + // 'as' => 'playground.matrix.resource.tags.put.id', // 'uses' => 'TagController@store', // ])->whereUuid('tag')->can('update', 'tag'); diff --git a/routes/teams.php b/routes/teams.php index 4c8afff..5f9925f 100644 --- a/routes/teams.php +++ b/routes/teams.php @@ -1,4 +1,7 @@ can('edit', 'team'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.teams.go', + // 'as' => 'playground.matrix.resource.teams.go', // 'uses' => 'TeamController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'team'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.teams.slug', + // 'as' => 'playground.matrix.resource.teams.slug', // 'uses' => 'TeamController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.teams.store', + // 'as' => 'playground.matrix.resource.teams.store', // 'uses' => 'TeamController@store', - // ])->can('store', \Playground\Matrix\Models\Team::class); + // ])->can('store', Playground\Matrix\Models\Team::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Team::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.teams.put', + // 'as' => 'playground.matrix.resource.teams.put', // 'uses' => 'TeamController@store', - // ])->can('store', \Playground\Matrix\Models\Team::class); + // ])->can('store', Playground\Matrix\Models\Team::class); // // Route::put('/{team}', [ - // 'as' => 'playground.matrix.resource.teams.put.id', + // 'as' => 'playground.matrix.resource.teams.put.id', // 'uses' => 'TeamController@store', // ])->whereUuid('team')->can('update', 'team'); diff --git a/routes/tickets.php b/routes/tickets.php index 4c758ce..d7d8822 100644 --- a/routes/tickets.php +++ b/routes/tickets.php @@ -1,4 +1,7 @@ can('edit', 'ticket'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.tickets.go', + // 'as' => 'playground.matrix.resource.tickets.go', // 'uses' => 'TicketController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'ticket'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.tickets.slug', + // 'as' => 'playground.matrix.resource.tickets.slug', // 'uses' => 'TicketController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.tickets.store', + // 'as' => 'playground.matrix.resource.tickets.store', // 'uses' => 'TicketController@store', - // ])->can('store', \Playground\Matrix\Models\Ticket::class); + // ])->can('store', Playground\Matrix\Models\Ticket::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Ticket::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.tickets.put', + // 'as' => 'playground.matrix.resource.tickets.put', // 'uses' => 'TicketController@store', - // ])->can('store', \Playground\Matrix\Models\Ticket::class); + // ])->can('store', Playground\Matrix\Models\Ticket::class); // // Route::put('/{ticket}', [ - // 'as' => 'playground.matrix.resource.tickets.put.id', + // 'as' => 'playground.matrix.resource.tickets.put.id', // 'uses' => 'TicketController@store', // ])->whereUuid('ticket')->can('update', 'ticket'); diff --git a/routes/versions.php b/routes/versions.php index 4d247fb..cc1eaa6 100644 --- a/routes/versions.php +++ b/routes/versions.php @@ -1,4 +1,7 @@ can('edit', 'version'); // Route::get('/go/{id}', [ - // 'as' => 'playground.matrix.resource.versions.go', + // 'as' => 'playground.matrix.resource.versions.go', // 'uses' => 'VersionController@go', // ]); @@ -47,14 +50,14 @@ ->can('detail', 'version'); // Route::get('/{slug}', [ - // 'as' => 'playground.matrix.resource.versions.slug', + // 'as' => 'playground.matrix.resource.versions.slug', // 'uses' => 'VersionController@slug', // ])->where('slug', '[a-zA-Z0-9\-]+'); // Route::post('/store', [ - // 'as' => 'playground.matrix.resource.versions.store', + // 'as' => 'playground.matrix.resource.versions.store', // 'uses' => 'VersionController@store', - // ])->can('store', \Playground\Matrix\Models\Version::class); + // ])->can('store', Playground\Matrix\Models\Version::class); // API @@ -90,12 +93,12 @@ ])->can('store', Playground\Matrix\Models\Version::class); // Route::put('/', [ - // 'as' => 'playground.matrix.resource.versions.put', + // 'as' => 'playground.matrix.resource.versions.put', // 'uses' => 'VersionController@store', - // ])->can('store', \Playground\Matrix\Models\Version::class); + // ])->can('store', Playground\Matrix\Models\Version::class); // // Route::put('/{version}', [ - // 'as' => 'playground.matrix.resource.versions.put.id', + // 'as' => 'playground.matrix.resource.versions.put.id', // 'uses' => 'VersionController@store', // ])->whereUuid('version')->can('update', 'version'); diff --git a/src/Http/Controllers/BacklogController.php b/src/Http/Controllers/BacklogController.php index 20b83f0..867d5c1 100644 --- a/src/Http/Controllers/BacklogController.php +++ b/src/Http/Controllers/BacklogController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Backlog', 'model_label_plural' => 'Backlogs', 'model_route' => 'playground.matrix.resource.backlogs', @@ -50,13 +40,13 @@ class BacklogController extends Controller ]; /** - * CREATE the Backlog resource in storage. + * Create the Backlog resource in storage. * - * @route GET /resource/matrix/backl*ogs/create playground.matrix.resource.backlogs.create + * @route GET /resource/matrix/backlogs/create playground.matrix.resource.backlogs.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Backlog\CreateRequest $request + ): JsonResponse|View|Resources\Backlog { $validated = $request->validated(); @@ -64,6 +54,12 @@ public function create( $backlog = new Backlog($validated); + if ($request->expectsJson()) { + return (new Resources\Backlog($backlog))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -81,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $backlog->toArray(); if (! empty($validated['_return_url'])) { @@ -96,7 +88,7 @@ public function create( session()->flashInput($flash); } - return view($this->getViewPath('backlog', 'form'), $data); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -106,12 +98,26 @@ public function create( */ public function edit( Backlog $backlog, - EditRequest $request - ): JsonResponse|View { + Requests\Backlog\EditRequest $request + ): JsonResponse|View|Resources\Backlog { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Backlog($backlog))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $backlog->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $backlog->id, @@ -129,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $backlog->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::backlog/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -155,10 +147,17 @@ public function edit( */ public function destroy( Backlog $backlog, - DestroyRequest $request + Requests\Backlog\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $backlog->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $backlog->delete(); } else { @@ -175,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.backlogs')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -185,13 +184,18 @@ public function destroy( */ public function lock( Backlog $backlog, - LockRequest $request - ): JsonResponse|RedirectResponse|BacklogResource { + Requests\Backlog\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Backlog { + $validated = $request->validated(); $user = $request->user(); - $backlog->setAttribute('locked', true); + if ($user?->id) { + $backlog->modified_by_id = $user->id; + } + + $backlog->locked = true; $backlog->save(); @@ -201,10 +205,11 @@ public function lock( 'timestamp' => Carbon::now()->toJson(), 'info' => $this->packageInfo, ]; - // dump($request); if ($request->expectsJson()) { - return (new BacklogResource($backlog))->response($request); + return (new Resources\Backlog($backlog))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -213,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.backlogs.show', ['backlog' => $backlog->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['backlog' => $backlog->id])); } /** @@ -222,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.backlogs */ public function index( - IndexRequest $request - ): JsonResponse|View|BacklogCollection { + Requests\Backlog\IndexRequest $request + ): JsonResponse|View|Resources\BacklogCollection { + $user = $request->user(); $validated = $request->validated(); @@ -233,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -257,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new BacklogCollection($paginator))->response($request); + return (new Resources\BacklogCollection($paginator))->response($request); } $meta = [ @@ -283,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::backlog/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -296,16 +303,23 @@ public function index( */ public function restore( Backlog $backlog, - RestoreRequest $request - ): JsonResponse|RedirectResponse|BacklogResource { + Requests\Backlog\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Backlog { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $backlog->modified_by_id = $user->id; + } + $backlog->restore(); if ($request->expectsJson()) { - return (new BacklogResource($backlog))->response($request); + return (new Resources\Backlog($backlog))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -314,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.backlogs.show', ['backlog' => $backlog->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['backlog' => $backlog->id])); } /** @@ -324,8 +341,9 @@ public function restore( */ public function show( Backlog $backlog, - ShowRequest $request - ): JsonResponse|View|BacklogResource { + Requests\Backlog\ShowRequest $request + ): JsonResponse|View|Resources\Backlog { + $validated = $request->validated(); $user = $request->user(); @@ -339,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new BacklogResource($backlog))->response($request); + return (new Resources\Backlog($backlog))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -350,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::backlog/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -362,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.backlogs.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|BacklogResource { + Requests\Backlog\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Backlog { + $validated = $request->validated(); $user = $request->user(); $backlog = new Backlog($validated); + if ($user?->id) { + $backlog->created_by_id = $user->id; + } + $backlog->save(); if ($request->expectsJson()) { - return (new BacklogResource($backlog))->response($request); + return (new Resources\Backlog($backlog))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -382,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.backlogs.show', ['backlog' => $backlog->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['backlog' => $backlog->id])); } /** @@ -392,18 +419,25 @@ public function store( */ public function unlock( Backlog $backlog, - UnlockRequest $request - ): JsonResponse|RedirectResponse|BacklogResource { + Requests\Backlog\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Backlog { + $validated = $request->validated(); $user = $request->user(); - $backlog->setAttribute('locked', false); + $backlog->locked = false; + + if ($user?->id) { + $backlog->modified_by_id = $user->id; + } $backlog->save(); if ($request->expectsJson()) { - return (new BacklogResource($backlog))->response($request); + return (new Resources\Backlog($backlog))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -412,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.backlogs.show', ['backlog' => $backlog->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['backlog' => $backlog->id])); } /** @@ -422,16 +459,23 @@ public function unlock( */ public function update( Backlog $backlog, - UpdateRequest $request - ): JsonResponse|RedirectResponse|BacklogResource { + Requests\Backlog\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Backlog { + $validated = $request->validated(); $user = $request->user(); $backlog->update($validated); + if ($user?->id) { + $backlog->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new BacklogResource($backlog))->response($request); + return (new Resources\Backlog($backlog))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -440,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.backlogs.show', ['backlog' => $backlog->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['backlog' => $backlog->id])); } } diff --git a/src/Http/Controllers/BoardController.php b/src/Http/Controllers/BoardController.php index 4b220cb..a53968e 100644 --- a/src/Http/Controllers/BoardController.php +++ b/src/Http/Controllers/BoardController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Board', 'model_label_plural' => 'Boards', 'model_route' => 'playground.matrix.resource.boards', @@ -50,19 +40,26 @@ class BoardController extends Controller ]; /** - * CREATE the Board resource in storage. + * Create the Board resource in storage. * * @route GET /resource/matrix/boards/create playground.matrix.resource.boards.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Board\CreateRequest $request + ): JsonResponse|View|Resources\Board { + $validated = $request->validated(); $user = $request->user(); $board = new Board($validated); + if ($request->expectsJson()) { + return (new Resources\Board($board))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $board->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::board/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Board $board, - EditRequest $request - ): JsonResponse|View { + Requests\Board\EditRequest $request + ): JsonResponse|View|Resources\Board { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Board($board))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $board->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $board->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $board->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::board/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Board $board, - DestroyRequest $request + Requests\Board\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $board->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $board->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.boards')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Board $board, - LockRequest $request - ): JsonResponse|RedirectResponse|BoardResource { + Requests\Board\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Board { + $validated = $request->validated(); $user = $request->user(); - $board->setAttribute('locked', true); + if ($user?->id) { + $board->modified_by_id = $user->id; + } + + $board->locked = true; $board->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new BoardResource($board))->response($request); + return (new Resources\Board($board))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.boards.show', ['board' => $board->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['board' => $board->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.boards */ public function index( - IndexRequest $request - ): JsonResponse|View|BoardCollection { + Requests\Board\IndexRequest $request + ): JsonResponse|View|Resources\BoardCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new BoardCollection($paginator))->response($request); + return (new Resources\BoardCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::board/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Board $board, - RestoreRequest $request - ): JsonResponse|RedirectResponse|BoardResource { + Requests\Board\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Board { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $board->modified_by_id = $user->id; + } + $board->restore(); if ($request->expectsJson()) { - return (new BoardResource($board))->response($request); + return (new Resources\Board($board))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.boards.show', ['board' => $board->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['board' => $board->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Board $board, - ShowRequest $request - ): JsonResponse|View|BoardResource { + Requests\Board\ShowRequest $request + ): JsonResponse|View|Resources\Board { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new BoardResource($board))->response($request); + return (new Resources\Board($board))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::board/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.boards.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|BoardResource { + Requests\Board\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Board { + $validated = $request->validated(); $user = $request->user(); $board = new Board($validated); + if ($user?->id) { + $board->created_by_id = $user->id; + } + $board->save(); if ($request->expectsJson()) { - return (new BoardResource($board))->response($request); + return (new Resources\Board($board))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.boards.show', ['board' => $board->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['board' => $board->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Board $board, - UnlockRequest $request - ): JsonResponse|RedirectResponse|BoardResource { + Requests\Board\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Board { + $validated = $request->validated(); $user = $request->user(); - $board->setAttribute('locked', false); + $board->locked = false; + + if ($user?->id) { + $board->modified_by_id = $user->id; + } $board->save(); if ($request->expectsJson()) { - return (new BoardResource($board))->response($request); + return (new Resources\Board($board))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.boards.show', ['board' => $board->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['board' => $board->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Board $board, - UpdateRequest $request - ): JsonResponse|RedirectResponse|BoardResource { + Requests\Board\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Board { + $validated = $request->validated(); $user = $request->user(); $board->update($validated); + if ($user?->id) { + $board->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new BoardResource($board))->response($request); + return (new Resources\Board($board))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.boards.show', ['board' => $board->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['board' => $board->id])); } } diff --git a/src/Http/Controllers/Controller.php b/src/Http/Controllers/Controller.php index 2fef907..61cea39 100644 --- a/src/Http/Controllers/Controller.php +++ b/src/Http/Controllers/Controller.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Epic', 'model_label_plural' => 'Epics', 'model_route' => 'playground.matrix.resource.epics', @@ -50,19 +40,26 @@ class EpicController extends Controller ]; /** - * CREATE the Epic resource in storage. + * Create the Epic resource in storage. * * @route GET /resource/matrix/epics/create playground.matrix.resource.epics.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Epic\CreateRequest $request + ): JsonResponse|View|Resources\Epic { + $validated = $request->validated(); $user = $request->user(); $epic = new Epic($validated); + if ($request->expectsJson()) { + return (new Resources\Epic($epic))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $epic->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::epic/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Epic $epic, - EditRequest $request - ): JsonResponse|View { + Requests\Epic\EditRequest $request + ): JsonResponse|View|Resources\Epic { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Epic($epic))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $epic->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $epic->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $epic->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::epic/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Epic $epic, - DestroyRequest $request + Requests\Epic\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $epic->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $epic->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.epics')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Epic $epic, - LockRequest $request - ): JsonResponse|RedirectResponse|EpicResource { + Requests\Epic\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Epic { + $validated = $request->validated(); $user = $request->user(); - $epic->setAttribute('locked', true); + if ($user?->id) { + $epic->modified_by_id = $user->id; + } + + $epic->locked = true; $epic->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new EpicResource($epic))->response($request); + return (new Resources\Epic($epic))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.epics.show', ['epic' => $epic->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['epic' => $epic->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.epics */ public function index( - IndexRequest $request - ): JsonResponse|View|EpicCollection { + Requests\Epic\IndexRequest $request + ): JsonResponse|View|Resources\EpicCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new EpicCollection($paginator))->response($request); + return (new Resources\EpicCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::epic/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Epic $epic, - RestoreRequest $request - ): JsonResponse|RedirectResponse|EpicResource { + Requests\Epic\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Epic { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $epic->modified_by_id = $user->id; + } + $epic->restore(); if ($request->expectsJson()) { - return (new EpicResource($epic))->response($request); + return (new Resources\Epic($epic))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.epics.show', ['epic' => $epic->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['epic' => $epic->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Epic $epic, - ShowRequest $request - ): JsonResponse|View|EpicResource { + Requests\Epic\ShowRequest $request + ): JsonResponse|View|Resources\Epic { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new EpicResource($epic))->response($request); + return (new Resources\Epic($epic))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::epic/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.epics.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|EpicResource { + Requests\Epic\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Epic { + $validated = $request->validated(); $user = $request->user(); $epic = new Epic($validated); + if ($user?->id) { + $epic->created_by_id = $user->id; + } + $epic->save(); if ($request->expectsJson()) { - return (new EpicResource($epic))->response($request); + return (new Resources\Epic($epic))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.epics.show', ['epic' => $epic->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['epic' => $epic->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Epic $epic, - UnlockRequest $request - ): JsonResponse|RedirectResponse|EpicResource { + Requests\Epic\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Epic { + $validated = $request->validated(); $user = $request->user(); - $epic->setAttribute('locked', false); + $epic->locked = false; + + if ($user?->id) { + $epic->modified_by_id = $user->id; + } $epic->save(); if ($request->expectsJson()) { - return (new EpicResource($epic))->response($request); + return (new Resources\Epic($epic))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.epics.show', ['epic' => $epic->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['epic' => $epic->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Epic $epic, - UpdateRequest $request - ): JsonResponse|RedirectResponse|EpicResource { + Requests\Epic\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Epic { + $validated = $request->validated(); $user = $request->user(); $epic->update($validated); + if ($user?->id) { + $epic->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new EpicResource($epic))->response($request); + return (new Resources\Epic($epic))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.epics.show', ['epic' => $epic->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['epic' => $epic->id])); } } diff --git a/src/Http/Controllers/FlowController.php b/src/Http/Controllers/FlowController.php index 52f6227..53916d4 100644 --- a/src/Http/Controllers/FlowController.php +++ b/src/Http/Controllers/FlowController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Flow', 'model_label_plural' => 'Flows', 'model_route' => 'playground.matrix.resource.flows', @@ -50,19 +40,26 @@ class FlowController extends Controller ]; /** - * CREATE the Flow resource in storage. + * Create the Flow resource in storage. * * @route GET /resource/matrix/flows/create playground.matrix.resource.flows.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Flow\CreateRequest $request + ): JsonResponse|View|Resources\Flow { + $validated = $request->validated(); $user = $request->user(); $flow = new Flow($validated); + if ($request->expectsJson()) { + return (new Resources\Flow($flow))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $flow->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::flow/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Flow $flow, - EditRequest $request - ): JsonResponse|View { + Requests\Flow\EditRequest $request + ): JsonResponse|View|Resources\Flow { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Flow($flow))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $flow->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $flow->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $flow->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::flow/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Flow $flow, - DestroyRequest $request + Requests\Flow\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $flow->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $flow->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.flows')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Flow $flow, - LockRequest $request - ): JsonResponse|RedirectResponse|FlowResource { + Requests\Flow\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Flow { + $validated = $request->validated(); $user = $request->user(); - $flow->setAttribute('locked', true); + if ($user?->id) { + $flow->modified_by_id = $user->id; + } + + $flow->locked = true; $flow->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new FlowResource($flow))->response($request); + return (new Resources\Flow($flow))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.flows.show', ['flow' => $flow->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['flow' => $flow->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.flows */ public function index( - IndexRequest $request - ): JsonResponse|View|FlowCollection { + Requests\Flow\IndexRequest $request + ): JsonResponse|View|Resources\FlowCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new FlowCollection($paginator))->response($request); + return (new Resources\FlowCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::flow/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Flow $flow, - RestoreRequest $request - ): JsonResponse|RedirectResponse|FlowResource { + Requests\Flow\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Flow { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $flow->modified_by_id = $user->id; + } + $flow->restore(); if ($request->expectsJson()) { - return (new FlowResource($flow))->response($request); + return (new Resources\Flow($flow))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.flows.show', ['flow' => $flow->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['flow' => $flow->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Flow $flow, - ShowRequest $request - ): JsonResponse|View|FlowResource { + Requests\Flow\ShowRequest $request + ): JsonResponse|View|Resources\Flow { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new FlowResource($flow))->response($request); + return (new Resources\Flow($flow))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::flow/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.flows.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|FlowResource { + Requests\Flow\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Flow { + $validated = $request->validated(); $user = $request->user(); $flow = new Flow($validated); + if ($user?->id) { + $flow->created_by_id = $user->id; + } + $flow->save(); if ($request->expectsJson()) { - return (new FlowResource($flow))->response($request); + return (new Resources\Flow($flow))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.flows.show', ['flow' => $flow->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['flow' => $flow->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Flow $flow, - UnlockRequest $request - ): JsonResponse|RedirectResponse|FlowResource { + Requests\Flow\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Flow { + $validated = $request->validated(); $user = $request->user(); - $flow->setAttribute('locked', false); + $flow->locked = false; + + if ($user?->id) { + $flow->modified_by_id = $user->id; + } $flow->save(); if ($request->expectsJson()) { - return (new FlowResource($flow))->response($request); + return (new Resources\Flow($flow))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.flows.show', ['flow' => $flow->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['flow' => $flow->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Flow $flow, - UpdateRequest $request - ): JsonResponse|RedirectResponse|FlowResource { + Requests\Flow\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Flow { + $validated = $request->validated(); $user = $request->user(); $flow->update($validated); + if ($user?->id) { + $flow->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new FlowResource($flow))->response($request); + return (new Resources\Flow($flow))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.flows.show', ['flow' => $flow->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['flow' => $flow->id])); } } diff --git a/src/Http/Controllers/IndexController.php b/src/Http/Controllers/IndexController.php index 050a4ed..e893341 100644 --- a/src/Http/Controllers/IndexController.php +++ b/src/Http/Controllers/IndexController.php @@ -1,9 +1,9 @@ + */ + public array $packageInfo = [ + 'model_attribute' => 'title', + 'model_label' => 'Matrix', + 'model_label_plural' => 'Matrices', + 'model_route' => 'playground.matrix.resource.matrices', + 'model_slug' => 'matrix', + 'model_slug_plural' => 'matrices', + 'module_label' => 'Matrix', + 'module_label_plural' => 'Matrices', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:matrix', + 'table' => 'matrix_matrices', + 'view' => 'playground-matrix-resource::matrix', + ]; + + /** + * Create the Matrix resource in storage. + * + * @route GET /resource/matrix/matrices/create playground.matrix.resource.matrices.create + */ + public function create( + Requests\Matrix\CreateRequest $request + ): JsonResponse|View|Resources\Matrix { + + $validated = $request->validated(); + + $user = $request->user(); + + $matrix = new Matrix($validated); + + if ($request->expectsJson()) { + return (new Resources\Matrix($matrix))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $meta = [ + 'session_user_id' => $user?->id, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, + ]; + + $meta['input'] = $request->input(); + $meta['validated'] = $request->validated(); + + $data = [ + 'data' => $matrix, + 'meta' => $meta, + '_method' => 'post', + ]; + + $flash = $matrix->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + + if (! $request->session()->has('errors')) { + session()->flashInput($flash); + } + + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); + } + + /** + * Edit the Matrix resource in storage. + * + * @route GET /resource/matrix/matrices/edit playground.matrix.resource.matrices.edit + */ + public function edit( + Matrix $matrix, + Requests\Matrix\EditRequest $request + ): JsonResponse|View|Resources\Matrix { + + $validated = $request->validated(); + + $user = $request->user(); + + if ($request->expectsJson()) { + return (new Resources\Matrix($matrix))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $matrix->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + + $meta = [ + 'session_user_id' => $user?->id, + 'id' => $matrix->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, + ]; + + $meta['input'] = $request->input(); + $meta['validated'] = $request->validated(); + + $data = [ + 'data' => $matrix, + 'meta' => $meta, + '_method' => 'patch', + ]; + + session()->flashInput($flash); + + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); + } + + /** + * Remove the Matrix resource from storage. + * + * @route DELETE /resource/matrix/{matrix} playground.matrix.resource.matrices.destroy + */ + public function destroy( + Matrix $matrix, + Requests\Matrix\DestroyRequest $request + ): Response|RedirectResponse { + + $validated = $request->validated(); + + $user = $request->user(); + + if ($user?->id) { + $matrix->modified_by_id = $user->id; + } + + if (empty($validated['force'])) { + $matrix->delete(); + } else { + $matrix->forceDelete(); + } + + if ($request->expectsJson()) { + return response()->noContent(); + } + + $returnUrl = $validated['_return_url'] ?? ''; + + if ($returnUrl && is_string($returnUrl)) { + return redirect($returnUrl); + } + + return redirect(route($this->packageInfo['model_route'])); + } + + /** + * Lock the Matrix resource in storage. + * + * @route PUT /resource/matrix/{matrix} playground.matrix.resource.matrices.lock + */ + public function lock( + Matrix $matrix, + Requests\Matrix\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Matrix { + + $validated = $request->validated(); + + $user = $request->user(); + + if ($user?->id) { + $matrix->modified_by_id = $user->id; + } + + $matrix->locked = true; + + $matrix->save(); + + $meta = [ + 'session_user_id' => $user?->id, + 'id' => $matrix->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, + ]; + + if ($request->expectsJson()) { + return (new Resources\Matrix($matrix))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $returnUrl = $validated['_return_url'] ?? ''; + + if ($returnUrl && is_string($returnUrl)) { + return redirect($returnUrl); + } + + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['matrix' => $matrix->id])); + } + + /** + * Display a listing of Matrix resources. + * + * @route GET /resource/matrix playground.matrix.resource.matrices + */ + public function index( + Requests\Matrix\IndexRequest $request + ): JsonResponse|View|Resources\MatrixCollection { + + $user = $request->user(); + + $validated = $request->validated(); + + $query = Matrix::addSelect(sprintf('%1$s.*', $this->packageInfo['table'])); + + $query->sort($validated['sort'] ?? null); + + if (! empty($validated['filter']) && is_array($validated['filter'])) { + + $query->filterTrash($validated['filter']['trash'] ?? null); + + $query->filterIds( + $request->getPaginationIds(), + $validated + ); + + $query->filterFlags( + $request->getPaginationFlags(), + $validated + ); + + $query->filterDates( + $request->getPaginationDates(), + $validated + ); + + $query->filterColumns( + $request->getPaginationColumns(), + $validated + ); + } + + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate($perPage); + + $paginator->appends($validated); + + if ($request->expectsJson()) { + return (new Resources\MatrixCollection($paginator))->response($request); + } + + $meta = [ + 'session_user_id' => $user?->id, + 'columns' => $request->getPaginationColumns(), + 'dates' => $request->getPaginationDates(), + 'flags' => $request->getPaginationFlags(), + 'ids' => $request->getPaginationIds(), + 'rules' => $request->rules(), + 'sortable' => $request->getSortable(), + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, + ]; + + $data = [ + 'paginator' => $paginator, + 'meta' => $meta, + ]; + + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); + } + + /** + * Restore the Matrix resource from the trash. + * + * @route PUT /resource/matrix/restore/{matrix} playground.matrix.resource.matrices.restore + */ + public function restore( + Matrix $matrix, + Requests\Matrix\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Matrix { + + $validated = $request->validated(); + + $user = $request->user(); + + if ($user?->id) { + $matrix->modified_by_id = $user->id; + } + + $matrix->restore(); + + if ($request->expectsJson()) { + return (new Resources\Matrix($matrix))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $returnUrl = $validated['_return_url'] ?? ''; + + if ($returnUrl && is_string($returnUrl)) { + return redirect($returnUrl); + } + + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['matrix' => $matrix->id])); + } + + /** + * Display the Matrix resource. + * + * @route GET /resource/matrix/{matrix} playground.matrix.resource.matrices.show + */ + public function show( + Matrix $matrix, + Requests\Matrix\ShowRequest $request + ): JsonResponse|View|Resources\Matrix { + + $validated = $request->validated(); + + $user = $request->user(); + + $meta = [ + 'session_user_id' => $user?->id, + 'id' => $matrix->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, + ]; + + if ($request->expectsJson()) { + return (new Resources\Matrix($matrix))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $meta['input'] = $request->input(); + $meta['validated'] = $request->validated(); + + $data = [ + 'data' => $matrix, + 'meta' => $meta, + ]; + + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); + } + + /** + * Store a newly created API Matrix resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.matrices.post + */ + public function store( + Requests\Matrix\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Matrix { + + $validated = $request->validated(); + + $user = $request->user(); + + $matrix = new Matrix($validated); + + if ($user?->id) { + $matrix->created_by_id = $user->id; + } + + $matrix->save(); + + if ($request->expectsJson()) { + return (new Resources\Matrix($matrix))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $returnUrl = $validated['_return_url'] ?? ''; + + if ($returnUrl && is_string($returnUrl)) { + return redirect($returnUrl); + } + + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['matrix' => $matrix->id])); + } + + /** + * Unlock the Matrix resource in storage. + * + * @route DELETE /resource/matrix/lock/{matrix} playground.matrix.resource.matrices.unlock + */ + public function unlock( + Matrix $matrix, + Requests\Matrix\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Matrix { + + $validated = $request->validated(); + + $user = $request->user(); + + $matrix->locked = false; + + if ($user?->id) { + $matrix->modified_by_id = $user->id; + } + + $matrix->save(); + + if ($request->expectsJson()) { + return (new Resources\Matrix($matrix))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $returnUrl = $validated['_return_url'] ?? ''; + + if ($returnUrl && is_string($returnUrl)) { + return redirect($returnUrl); + } + + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['matrix' => $matrix->id])); + } + + /** + * Update the Matrix resource in storage. + * + * @route PATCH /resource/matrix/{matrix} playground.matrix.resource.matrices.patch + */ + public function update( + Matrix $matrix, + Requests\Matrix\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Matrix { + + $validated = $request->validated(); + + $user = $request->user(); + + $matrix->update($validated); + + if ($user?->id) { + $matrix->modified_by_id = $user->id; + } + + if ($request->expectsJson()) { + return (new Resources\Matrix($matrix))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $returnUrl = $validated['_return_url'] ?? ''; + + if ($returnUrl && is_string($returnUrl)) { + return redirect($returnUrl); + } + + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['matrix' => $matrix->id])); + } +} diff --git a/src/Http/Controllers/MilestoneController.php b/src/Http/Controllers/MilestoneController.php index a61d898..e58039f 100644 --- a/src/Http/Controllers/MilestoneController.php +++ b/src/Http/Controllers/MilestoneController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Milestone', 'model_label_plural' => 'Milestones', 'model_route' => 'playground.matrix.resource.milestones', @@ -50,19 +40,26 @@ class MilestoneController extends Controller ]; /** - * CREATE the Milestone resource in storage. + * Create the Milestone resource in storage. * * @route GET /resource/matrix/milestones/create playground.matrix.resource.milestones.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Milestone\CreateRequest $request + ): JsonResponse|View|Resources\Milestone { + $validated = $request->validated(); $user = $request->user(); $milestone = new Milestone($validated); + if ($request->expectsJson()) { + return (new Resources\Milestone($milestone))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $milestone->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::milestone/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Milestone $milestone, - EditRequest $request - ): JsonResponse|View { + Requests\Milestone\EditRequest $request + ): JsonResponse|View|Resources\Milestone { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Milestone($milestone))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $milestone->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $milestone->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $milestone->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::milestone/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Milestone $milestone, - DestroyRequest $request + Requests\Milestone\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $milestone->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $milestone->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.milestones')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Milestone $milestone, - LockRequest $request - ): JsonResponse|RedirectResponse|MilestoneResource { + Requests\Milestone\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Milestone { + $validated = $request->validated(); $user = $request->user(); - $milestone->setAttribute('locked', true); + if ($user?->id) { + $milestone->modified_by_id = $user->id; + } + + $milestone->locked = true; $milestone->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new MilestoneResource($milestone))->response($request); + return (new Resources\Milestone($milestone))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.milestones.show', ['milestone' => $milestone->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['milestone' => $milestone->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.milestones */ public function index( - IndexRequest $request - ): JsonResponse|View|MilestoneCollection { + Requests\Milestone\IndexRequest $request + ): JsonResponse|View|Resources\MilestoneCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new MilestoneCollection($paginator))->response($request); + return (new Resources\MilestoneCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::milestone/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Milestone $milestone, - RestoreRequest $request - ): JsonResponse|RedirectResponse|MilestoneResource { + Requests\Milestone\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Milestone { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $milestone->modified_by_id = $user->id; + } + $milestone->restore(); if ($request->expectsJson()) { - return (new MilestoneResource($milestone))->response($request); + return (new Resources\Milestone($milestone))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.milestones.show', ['milestone' => $milestone->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['milestone' => $milestone->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Milestone $milestone, - ShowRequest $request - ): JsonResponse|View|MilestoneResource { + Requests\Milestone\ShowRequest $request + ): JsonResponse|View|Resources\Milestone { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new MilestoneResource($milestone))->response($request); + return (new Resources\Milestone($milestone))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::milestone/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.milestones.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|MilestoneResource { + Requests\Milestone\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Milestone { + $validated = $request->validated(); $user = $request->user(); $milestone = new Milestone($validated); + if ($user?->id) { + $milestone->created_by_id = $user->id; + } + $milestone->save(); if ($request->expectsJson()) { - return (new MilestoneResource($milestone))->response($request); + return (new Resources\Milestone($milestone))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.milestones.show', ['milestone' => $milestone->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['milestone' => $milestone->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Milestone $milestone, - UnlockRequest $request - ): JsonResponse|RedirectResponse|MilestoneResource { + Requests\Milestone\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Milestone { + $validated = $request->validated(); $user = $request->user(); - $milestone->setAttribute('locked', false); + $milestone->locked = false; + + if ($user?->id) { + $milestone->modified_by_id = $user->id; + } $milestone->save(); if ($request->expectsJson()) { - return (new MilestoneResource($milestone))->response($request); + return (new Resources\Milestone($milestone))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.milestones.show', ['milestone' => $milestone->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['milestone' => $milestone->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Milestone $milestone, - UpdateRequest $request - ): JsonResponse|RedirectResponse|MilestoneResource { + Requests\Milestone\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Milestone { + $validated = $request->validated(); $user = $request->user(); $milestone->update($validated); + if ($user?->id) { + $milestone->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new MilestoneResource($milestone))->response($request); + return (new Resources\Milestone($milestone))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.milestones.show', ['milestone' => $milestone->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['milestone' => $milestone->id])); } } diff --git a/src/Http/Controllers/NoteController.php b/src/Http/Controllers/NoteController.php index 5b3e2ee..ae8d50e 100644 --- a/src/Http/Controllers/NoteController.php +++ b/src/Http/Controllers/NoteController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Note', 'model_label_plural' => 'Notes', 'model_route' => 'playground.matrix.resource.notes', @@ -50,19 +40,26 @@ class NoteController extends Controller ]; /** - * CREATE the Note resource in storage. + * Create the Note resource in storage. * * @route GET /resource/matrix/notes/create playground.matrix.resource.notes.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Note\CreateRequest $request + ): JsonResponse|View|Resources\Note { + $validated = $request->validated(); $user = $request->user(); $note = new Note($validated); + if ($request->expectsJson()) { + return (new Resources\Note($note))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $note->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::note/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Note $note, - EditRequest $request - ): JsonResponse|View { + Requests\Note\EditRequest $request + ): JsonResponse|View|Resources\Note { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Note($note))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $note->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $note->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $note->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::note/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Note $note, - DestroyRequest $request + Requests\Note\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $note->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $note->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.notes')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Note $note, - LockRequest $request - ): JsonResponse|RedirectResponse|NoteResource { + Requests\Note\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Note { + $validated = $request->validated(); $user = $request->user(); - $note->setAttribute('locked', true); + if ($user?->id) { + $note->modified_by_id = $user->id; + } + + $note->locked = true; $note->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new NoteResource($note))->response($request); + return (new Resources\Note($note))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.notes.show', ['note' => $note->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['note' => $note->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.notes */ public function index( - IndexRequest $request - ): JsonResponse|View|NoteCollection { + Requests\Note\IndexRequest $request + ): JsonResponse|View|Resources\NoteCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new NoteCollection($paginator))->response($request); + return (new Resources\NoteCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::note/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Note $note, - RestoreRequest $request - ): JsonResponse|RedirectResponse|NoteResource { + Requests\Note\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Note { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $note->modified_by_id = $user->id; + } + $note->restore(); if ($request->expectsJson()) { - return (new NoteResource($note))->response($request); + return (new Resources\Note($note))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.notes.show', ['note' => $note->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['note' => $note->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Note $note, - ShowRequest $request - ): JsonResponse|View|NoteResource { + Requests\Note\ShowRequest $request + ): JsonResponse|View|Resources\Note { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new NoteResource($note))->response($request); + return (new Resources\Note($note))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::note/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.notes.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|NoteResource { + Requests\Note\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Note { + $validated = $request->validated(); $user = $request->user(); $note = new Note($validated); + if ($user?->id) { + $note->created_by_id = $user->id; + } + $note->save(); if ($request->expectsJson()) { - return (new NoteResource($note))->response($request); + return (new Resources\Note($note))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.notes.show', ['note' => $note->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['note' => $note->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Note $note, - UnlockRequest $request - ): JsonResponse|RedirectResponse|NoteResource { + Requests\Note\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Note { + $validated = $request->validated(); $user = $request->user(); - $note->setAttribute('locked', false); + $note->locked = false; + + if ($user?->id) { + $note->modified_by_id = $user->id; + } $note->save(); if ($request->expectsJson()) { - return (new NoteResource($note))->response($request); + return (new Resources\Note($note))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.notes.show', ['note' => $note->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['note' => $note->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Note $note, - UpdateRequest $request - ): JsonResponse|RedirectResponse|NoteResource { + Requests\Note\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Note { + $validated = $request->validated(); $user = $request->user(); $note->update($validated); + if ($user?->id) { + $note->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new NoteResource($note))->response($request); + return (new Resources\Note($note))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.notes.show', ['note' => $note->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['note' => $note->id])); } } diff --git a/src/Http/Controllers/ProjectController.php b/src/Http/Controllers/ProjectController.php index c52e0a1..3a75bd0 100644 --- a/src/Http/Controllers/ProjectController.php +++ b/src/Http/Controllers/ProjectController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Project', 'model_label_plural' => 'Projects', 'model_route' => 'playground.matrix.resource.projects', @@ -50,19 +40,26 @@ class ProjectController extends Controller ]; /** - * CREATE the Project resource in storage. + * Create the Project resource in storage. * * @route GET /resource/matrix/projects/create playground.matrix.resource.projects.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Project\CreateRequest $request + ): JsonResponse|View|Resources\Project { + $validated = $request->validated(); $user = $request->user(); $project = new Project($validated); + if ($request->expectsJson()) { + return (new Resources\Project($project))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $project->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::project/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Project $project, - EditRequest $request - ): JsonResponse|View { + Requests\Project\EditRequest $request + ): JsonResponse|View|Resources\Project { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Project($project))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $project->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $project->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $project->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::project/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Project $project, - DestroyRequest $request + Requests\Project\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $project->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $project->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.projects')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Project $project, - LockRequest $request - ): JsonResponse|RedirectResponse|ProjectResource { + Requests\Project\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Project { + $validated = $request->validated(); $user = $request->user(); - $project->setAttribute('locked', true); + if ($user?->id) { + $project->modified_by_id = $user->id; + } + + $project->locked = true; $project->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new ProjectResource($project))->response($request); + return (new Resources\Project($project))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.projects.show', ['project' => $project->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['project' => $project->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.projects */ public function index( - IndexRequest $request - ): JsonResponse|View|ProjectCollection { + Requests\Project\IndexRequest $request + ): JsonResponse|View|Resources\ProjectCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new ProjectCollection($paginator))->response($request); + return (new Resources\ProjectCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::project/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Project $project, - RestoreRequest $request - ): JsonResponse|RedirectResponse|ProjectResource { + Requests\Project\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Project { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $project->modified_by_id = $user->id; + } + $project->restore(); if ($request->expectsJson()) { - return (new ProjectResource($project))->response($request); + return (new Resources\Project($project))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.projects.show', ['project' => $project->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['project' => $project->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Project $project, - ShowRequest $request - ): JsonResponse|View|ProjectResource { + Requests\Project\ShowRequest $request + ): JsonResponse|View|Resources\Project { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new ProjectResource($project))->response($request); + return (new Resources\Project($project))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::project/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.projects.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|ProjectResource { + Requests\Project\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Project { + $validated = $request->validated(); $user = $request->user(); $project = new Project($validated); + if ($user?->id) { + $project->created_by_id = $user->id; + } + $project->save(); if ($request->expectsJson()) { - return (new ProjectResource($project))->response($request); + return (new Resources\Project($project))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.projects.show', ['project' => $project->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['project' => $project->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Project $project, - UnlockRequest $request - ): JsonResponse|RedirectResponse|ProjectResource { + Requests\Project\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Project { + $validated = $request->validated(); $user = $request->user(); - $project->setAttribute('locked', false); + $project->locked = false; + + if ($user?->id) { + $project->modified_by_id = $user->id; + } $project->save(); if ($request->expectsJson()) { - return (new ProjectResource($project))->response($request); + return (new Resources\Project($project))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.projects.show', ['project' => $project->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['project' => $project->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Project $project, - UpdateRequest $request - ): JsonResponse|RedirectResponse|ProjectResource { + Requests\Project\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Project { + $validated = $request->validated(); $user = $request->user(); $project->update($validated); + if ($user?->id) { + $project->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new ProjectResource($project))->response($request); + return (new Resources\Project($project))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.projects.show', ['project' => $project->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['project' => $project->id])); } } diff --git a/src/Http/Controllers/ReleaseController.php b/src/Http/Controllers/ReleaseController.php index 6cc5fa6..c424499 100644 --- a/src/Http/Controllers/ReleaseController.php +++ b/src/Http/Controllers/ReleaseController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Release', 'model_label_plural' => 'Releases', 'model_route' => 'playground.matrix.resource.releases', @@ -50,19 +40,26 @@ class ReleaseController extends Controller ]; /** - * CREATE the Release resource in storage. + * Create the Release resource in storage. * * @route GET /resource/matrix/releases/create playground.matrix.resource.releases.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Release\CreateRequest $request + ): JsonResponse|View|Resources\Release { + $validated = $request->validated(); $user = $request->user(); $release = new Release($validated); + if ($request->expectsJson()) { + return (new Resources\Release($release))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $release->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::release/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Release $release, - EditRequest $request - ): JsonResponse|View { + Requests\Release\EditRequest $request + ): JsonResponse|View|Resources\Release { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Release($release))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $release->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $release->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $release->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::release/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Release $release, - DestroyRequest $request + Requests\Release\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $release->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $release->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.releases')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Release $release, - LockRequest $request - ): JsonResponse|RedirectResponse|ReleaseResource { + Requests\Release\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Release { + $validated = $request->validated(); $user = $request->user(); - $release->setAttribute('locked', true); + if ($user?->id) { + $release->modified_by_id = $user->id; + } + + $release->locked = true; $release->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new ReleaseResource($release))->response($request); + return (new Resources\Release($release))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.releases.show', ['release' => $release->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['release' => $release->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.releases */ public function index( - IndexRequest $request - ): JsonResponse|View|ReleaseCollection { + Requests\Release\IndexRequest $request + ): JsonResponse|View|Resources\ReleaseCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new ReleaseCollection($paginator))->response($request); + return (new Resources\ReleaseCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::release/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Release $release, - RestoreRequest $request - ): JsonResponse|RedirectResponse|ReleaseResource { + Requests\Release\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Release { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $release->modified_by_id = $user->id; + } + $release->restore(); if ($request->expectsJson()) { - return (new ReleaseResource($release))->response($request); + return (new Resources\Release($release))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.releases.show', ['release' => $release->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['release' => $release->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Release $release, - ShowRequest $request - ): JsonResponse|View|ReleaseResource { + Requests\Release\ShowRequest $request + ): JsonResponse|View|Resources\Release { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new ReleaseResource($release))->response($request); + return (new Resources\Release($release))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::release/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.releases.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|ReleaseResource { + Requests\Release\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Release { + $validated = $request->validated(); $user = $request->user(); $release = new Release($validated); + if ($user?->id) { + $release->created_by_id = $user->id; + } + $release->save(); if ($request->expectsJson()) { - return (new ReleaseResource($release))->response($request); + return (new Resources\Release($release))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.releases.show', ['release' => $release->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['release' => $release->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Release $release, - UnlockRequest $request - ): JsonResponse|RedirectResponse|ReleaseResource { + Requests\Release\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Release { + $validated = $request->validated(); $user = $request->user(); - $release->setAttribute('locked', false); + $release->locked = false; + + if ($user?->id) { + $release->modified_by_id = $user->id; + } $release->save(); if ($request->expectsJson()) { - return (new ReleaseResource($release))->response($request); + return (new Resources\Release($release))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.releases.show', ['release' => $release->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['release' => $release->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Release $release, - UpdateRequest $request - ): JsonResponse|RedirectResponse|ReleaseResource { + Requests\Release\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Release { + $validated = $request->validated(); $user = $request->user(); $release->update($validated); + if ($user?->id) { + $release->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new ReleaseResource($release))->response($request); + return (new Resources\Release($release))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.releases.show', ['release' => $release->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['release' => $release->id])); } } diff --git a/src/Http/Controllers/RoadmapController.php b/src/Http/Controllers/RoadmapController.php index 44245ad..7f65d2f 100644 --- a/src/Http/Controllers/RoadmapController.php +++ b/src/Http/Controllers/RoadmapController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Roadmap', 'model_label_plural' => 'Roadmaps', 'model_route' => 'playground.matrix.resource.roadmaps', @@ -50,19 +40,26 @@ class RoadmapController extends Controller ]; /** - * CREATE the Roadmap resource in storage. + * Create the Roadmap resource in storage. * * @route GET /resource/matrix/roadmaps/create playground.matrix.resource.roadmaps.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Roadmap\CreateRequest $request + ): JsonResponse|View|Resources\Roadmap { + $validated = $request->validated(); $user = $request->user(); $roadmap = new Roadmap($validated); + if ($request->expectsJson()) { + return (new Resources\Roadmap($roadmap))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $roadmap->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::roadmap/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Roadmap $roadmap, - EditRequest $request - ): JsonResponse|View { + Requests\Roadmap\EditRequest $request + ): JsonResponse|View|Resources\Roadmap { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Roadmap($roadmap))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $roadmap->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $roadmap->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $roadmap->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::roadmap/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Roadmap $roadmap, - DestroyRequest $request + Requests\Roadmap\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $roadmap->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $roadmap->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.roadmaps')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Roadmap $roadmap, - LockRequest $request - ): JsonResponse|RedirectResponse|RoadmapResource { + Requests\Roadmap\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Roadmap { + $validated = $request->validated(); $user = $request->user(); - $roadmap->setAttribute('locked', true); + if ($user?->id) { + $roadmap->modified_by_id = $user->id; + } + + $roadmap->locked = true; $roadmap->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new RoadmapResource($roadmap))->response($request); + return (new Resources\Roadmap($roadmap))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.roadmaps.show', ['roadmap' => $roadmap->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['roadmap' => $roadmap->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.roadmaps */ public function index( - IndexRequest $request - ): JsonResponse|View|RoadmapCollection { + Requests\Roadmap\IndexRequest $request + ): JsonResponse|View|Resources\RoadmapCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new RoadmapCollection($paginator))->response($request); + return (new Resources\RoadmapCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::roadmap/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Roadmap $roadmap, - RestoreRequest $request - ): JsonResponse|RedirectResponse|RoadmapResource { + Requests\Roadmap\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Roadmap { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $roadmap->modified_by_id = $user->id; + } + $roadmap->restore(); if ($request->expectsJson()) { - return (new RoadmapResource($roadmap))->response($request); + return (new Resources\Roadmap($roadmap))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.roadmaps.show', ['roadmap' => $roadmap->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['roadmap' => $roadmap->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Roadmap $roadmap, - ShowRequest $request - ): JsonResponse|View|RoadmapResource { + Requests\Roadmap\ShowRequest $request + ): JsonResponse|View|Resources\Roadmap { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new RoadmapResource($roadmap))->response($request); + return (new Resources\Roadmap($roadmap))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::roadmap/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.roadmaps.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|RoadmapResource { + Requests\Roadmap\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Roadmap { + $validated = $request->validated(); $user = $request->user(); $roadmap = new Roadmap($validated); + if ($user?->id) { + $roadmap->created_by_id = $user->id; + } + $roadmap->save(); if ($request->expectsJson()) { - return (new RoadmapResource($roadmap))->response($request); + return (new Resources\Roadmap($roadmap))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.roadmaps.show', ['roadmap' => $roadmap->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['roadmap' => $roadmap->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Roadmap $roadmap, - UnlockRequest $request - ): JsonResponse|RedirectResponse|RoadmapResource { + Requests\Roadmap\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Roadmap { + $validated = $request->validated(); $user = $request->user(); - $roadmap->setAttribute('locked', false); + $roadmap->locked = false; + + if ($user?->id) { + $roadmap->modified_by_id = $user->id; + } $roadmap->save(); if ($request->expectsJson()) { - return (new RoadmapResource($roadmap))->response($request); + return (new Resources\Roadmap($roadmap))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.roadmaps.show', ['roadmap' => $roadmap->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['roadmap' => $roadmap->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Roadmap $roadmap, - UpdateRequest $request - ): JsonResponse|RedirectResponse|RoadmapResource { + Requests\Roadmap\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Roadmap { + $validated = $request->validated(); $user = $request->user(); $roadmap->update($validated); + if ($user?->id) { + $roadmap->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new RoadmapResource($roadmap))->response($request); + return (new Resources\Roadmap($roadmap))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.roadmaps.show', ['roadmap' => $roadmap->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['roadmap' => $roadmap->id])); } } diff --git a/src/Http/Controllers/SourceController.php b/src/Http/Controllers/SourceController.php index d100d89..419d4c2 100644 --- a/src/Http/Controllers/SourceController.php +++ b/src/Http/Controllers/SourceController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Source', 'model_label_plural' => 'Sources', 'model_route' => 'playground.matrix.resource.sources', @@ -50,19 +40,26 @@ class SourceController extends Controller ]; /** - * CREATE the Source resource in storage. + * Create the Source resource in storage. * * @route GET /resource/matrix/sources/create playground.matrix.resource.sources.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Source\CreateRequest $request + ): JsonResponse|View|Resources\Source { + $validated = $request->validated(); $user = $request->user(); $source = new Source($validated); + if ($request->expectsJson()) { + return (new Resources\Source($source))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $source->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::source/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Source $source, - EditRequest $request - ): JsonResponse|View { + Requests\Source\EditRequest $request + ): JsonResponse|View|Resources\Source { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Source($source))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $source->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $source->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $source->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::source/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Source $source, - DestroyRequest $request + Requests\Source\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $source->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $source->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.sources')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Source $source, - LockRequest $request - ): JsonResponse|RedirectResponse|SourceResource { + Requests\Source\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Source { + $validated = $request->validated(); $user = $request->user(); - $source->setAttribute('locked', true); + if ($user?->id) { + $source->modified_by_id = $user->id; + } + + $source->locked = true; $source->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new SourceResource($source))->response($request); + return (new Resources\Source($source))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.sources.show', ['source' => $source->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['source' => $source->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.sources */ public function index( - IndexRequest $request - ): JsonResponse|View|SourceCollection { + Requests\Source\IndexRequest $request + ): JsonResponse|View|Resources\SourceCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new SourceCollection($paginator))->response($request); + return (new Resources\SourceCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::source/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Source $source, - RestoreRequest $request - ): JsonResponse|RedirectResponse|SourceResource { + Requests\Source\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Source { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $source->modified_by_id = $user->id; + } + $source->restore(); if ($request->expectsJson()) { - return (new SourceResource($source))->response($request); + return (new Resources\Source($source))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.sources.show', ['source' => $source->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['source' => $source->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Source $source, - ShowRequest $request - ): JsonResponse|View|SourceResource { + Requests\Source\ShowRequest $request + ): JsonResponse|View|Resources\Source { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new SourceResource($source))->response($request); + return (new Resources\Source($source))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::source/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.sources.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|SourceResource { + Requests\Source\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Source { + $validated = $request->validated(); $user = $request->user(); $source = new Source($validated); + if ($user?->id) { + $source->created_by_id = $user->id; + } + $source->save(); if ($request->expectsJson()) { - return (new SourceResource($source))->response($request); + return (new Resources\Source($source))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.sources.show', ['source' => $source->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['source' => $source->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Source $source, - UnlockRequest $request - ): JsonResponse|RedirectResponse|SourceResource { + Requests\Source\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Source { + $validated = $request->validated(); $user = $request->user(); - $source->setAttribute('locked', false); + $source->locked = false; + + if ($user?->id) { + $source->modified_by_id = $user->id; + } $source->save(); if ($request->expectsJson()) { - return (new SourceResource($source))->response($request); + return (new Resources\Source($source))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.sources.show', ['source' => $source->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['source' => $source->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Source $source, - UpdateRequest $request - ): JsonResponse|RedirectResponse|SourceResource { + Requests\Source\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Source { + $validated = $request->validated(); $user = $request->user(); $source->update($validated); + if ($user?->id) { + $source->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new SourceResource($source))->response($request); + return (new Resources\Source($source))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.sources.show', ['source' => $source->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['source' => $source->id])); } } diff --git a/src/Http/Controllers/SprintController.php b/src/Http/Controllers/SprintController.php index 0841816..a570b43 100644 --- a/src/Http/Controllers/SprintController.php +++ b/src/Http/Controllers/SprintController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Sprint', 'model_label_plural' => 'Sprints', 'model_route' => 'playground.matrix.resource.sprints', @@ -50,19 +40,26 @@ class SprintController extends Controller ]; /** - * CREATE the Sprint resource in storage. + * Create the Sprint resource in storage. * * @route GET /resource/matrix/sprints/create playground.matrix.resource.sprints.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Sprint\CreateRequest $request + ): JsonResponse|View|Resources\Sprint { + $validated = $request->validated(); $user = $request->user(); $sprint = new Sprint($validated); + if ($request->expectsJson()) { + return (new Resources\Sprint($sprint))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $sprint->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::sprint/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Sprint $sprint, - EditRequest $request - ): JsonResponse|View { + Requests\Sprint\EditRequest $request + ): JsonResponse|View|Resources\Sprint { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Sprint($sprint))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $sprint->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $sprint->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $sprint->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::sprint/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Sprint $sprint, - DestroyRequest $request + Requests\Sprint\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $sprint->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $sprint->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.sprints')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Sprint $sprint, - LockRequest $request - ): JsonResponse|RedirectResponse|SprintResource { + Requests\Sprint\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Sprint { + $validated = $request->validated(); $user = $request->user(); - $sprint->setAttribute('locked', true); + if ($user?->id) { + $sprint->modified_by_id = $user->id; + } + + $sprint->locked = true; $sprint->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new SprintResource($sprint))->response($request); + return (new Resources\Sprint($sprint))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.sprints.show', ['sprint' => $sprint->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['sprint' => $sprint->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.sprints */ public function index( - IndexRequest $request - ): JsonResponse|View|SprintCollection { + Requests\Sprint\IndexRequest $request + ): JsonResponse|View|Resources\SprintCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new SprintCollection($paginator))->response($request); + return (new Resources\SprintCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::sprint/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Sprint $sprint, - RestoreRequest $request - ): JsonResponse|RedirectResponse|SprintResource { + Requests\Sprint\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Sprint { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $sprint->modified_by_id = $user->id; + } + $sprint->restore(); if ($request->expectsJson()) { - return (new SprintResource($sprint))->response($request); + return (new Resources\Sprint($sprint))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.sprints.show', ['sprint' => $sprint->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['sprint' => $sprint->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Sprint $sprint, - ShowRequest $request - ): JsonResponse|View|SprintResource { + Requests\Sprint\ShowRequest $request + ): JsonResponse|View|Resources\Sprint { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new SprintResource($sprint))->response($request); + return (new Resources\Sprint($sprint))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::sprint/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.sprints.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|SprintResource { + Requests\Sprint\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Sprint { + $validated = $request->validated(); $user = $request->user(); $sprint = new Sprint($validated); + if ($user?->id) { + $sprint->created_by_id = $user->id; + } + $sprint->save(); if ($request->expectsJson()) { - return (new SprintResource($sprint))->response($request); + return (new Resources\Sprint($sprint))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.sprints.show', ['sprint' => $sprint->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['sprint' => $sprint->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Sprint $sprint, - UnlockRequest $request - ): JsonResponse|RedirectResponse|SprintResource { + Requests\Sprint\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Sprint { + $validated = $request->validated(); $user = $request->user(); - $sprint->setAttribute('locked', false); + $sprint->locked = false; + + if ($user?->id) { + $sprint->modified_by_id = $user->id; + } $sprint->save(); if ($request->expectsJson()) { - return (new SprintResource($sprint))->response($request); + return (new Resources\Sprint($sprint))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.sprints.show', ['sprint' => $sprint->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['sprint' => $sprint->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Sprint $sprint, - UpdateRequest $request - ): JsonResponse|RedirectResponse|SprintResource { + Requests\Sprint\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Sprint { + $validated = $request->validated(); $user = $request->user(); $sprint->update($validated); + if ($user?->id) { + $sprint->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new SprintResource($sprint))->response($request); + return (new Resources\Sprint($sprint))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.sprints.show', ['sprint' => $sprint->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['sprint' => $sprint->id])); } } diff --git a/src/Http/Controllers/TagController.php b/src/Http/Controllers/TagController.php index b8912d9..a7557de 100644 --- a/src/Http/Controllers/TagController.php +++ b/src/Http/Controllers/TagController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Tag', 'model_label_plural' => 'Tags', 'model_route' => 'playground.matrix.resource.tags', @@ -50,19 +40,26 @@ class TagController extends Controller ]; /** - * CREATE the Tag resource in storage. + * Create the Tag resource in storage. * * @route GET /resource/matrix/tags/create playground.matrix.resource.tags.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Tag\CreateRequest $request + ): JsonResponse|View|Resources\Tag { + $validated = $request->validated(); $user = $request->user(); $tag = new Tag($validated); + if ($request->expectsJson()) { + return (new Resources\Tag($tag))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $tag->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::tag/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Tag $tag, - EditRequest $request - ): JsonResponse|View { + Requests\Tag\EditRequest $request + ): JsonResponse|View|Resources\Tag { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Tag($tag))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $tag->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $tag->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $tag->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::tag/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Tag $tag, - DestroyRequest $request + Requests\Tag\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $tag->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $tag->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.tags')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Tag $tag, - LockRequest $request - ): JsonResponse|RedirectResponse|TagResource { + Requests\Tag\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Tag { + $validated = $request->validated(); $user = $request->user(); - $tag->setAttribute('locked', true); + if ($user?->id) { + $tag->modified_by_id = $user->id; + } + + $tag->locked = true; $tag->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new TagResource($tag))->response($request); + return (new Resources\Tag($tag))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.tags.show', ['tag' => $tag->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['tag' => $tag->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.tags */ public function index( - IndexRequest $request - ): JsonResponse|View|TagCollection { + Requests\Tag\IndexRequest $request + ): JsonResponse|View|Resources\TagCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new TagCollection($paginator))->response($request); + return (new Resources\TagCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::tag/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Tag $tag, - RestoreRequest $request - ): JsonResponse|RedirectResponse|TagResource { + Requests\Tag\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Tag { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $tag->modified_by_id = $user->id; + } + $tag->restore(); if ($request->expectsJson()) { - return (new TagResource($tag))->response($request); + return (new Resources\Tag($tag))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.tags.show', ['tag' => $tag->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['tag' => $tag->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Tag $tag, - ShowRequest $request - ): JsonResponse|View|TagResource { + Requests\Tag\ShowRequest $request + ): JsonResponse|View|Resources\Tag { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new TagResource($tag))->response($request); + return (new Resources\Tag($tag))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::tag/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.tags.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|TagResource { + Requests\Tag\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Tag { + $validated = $request->validated(); $user = $request->user(); $tag = new Tag($validated); + if ($user?->id) { + $tag->created_by_id = $user->id; + } + $tag->save(); if ($request->expectsJson()) { - return (new TagResource($tag))->response($request); + return (new Resources\Tag($tag))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.tags.show', ['tag' => $tag->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['tag' => $tag->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Tag $tag, - UnlockRequest $request - ): JsonResponse|RedirectResponse|TagResource { + Requests\Tag\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Tag { + $validated = $request->validated(); $user = $request->user(); - $tag->setAttribute('locked', false); + $tag->locked = false; + + if ($user?->id) { + $tag->modified_by_id = $user->id; + } $tag->save(); if ($request->expectsJson()) { - return (new TagResource($tag))->response($request); + return (new Resources\Tag($tag))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.tags.show', ['tag' => $tag->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['tag' => $tag->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Tag $tag, - UpdateRequest $request - ): JsonResponse|RedirectResponse|TagResource { + Requests\Tag\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Tag { + $validated = $request->validated(); $user = $request->user(); $tag->update($validated); + if ($user?->id) { + $tag->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new TagResource($tag))->response($request); + return (new Resources\Tag($tag))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.tags.show', ['tag' => $tag->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['tag' => $tag->id])); } } diff --git a/src/Http/Controllers/TeamController.php b/src/Http/Controllers/TeamController.php index db0a079..ad0ad10 100644 --- a/src/Http/Controllers/TeamController.php +++ b/src/Http/Controllers/TeamController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Team', 'model_label_plural' => 'Teams', 'model_route' => 'playground.matrix.resource.teams', @@ -50,19 +40,26 @@ class TeamController extends Controller ]; /** - * CREATE the Team resource in storage. + * Create the Team resource in storage. * * @route GET /resource/matrix/teams/create playground.matrix.resource.teams.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Team\CreateRequest $request + ): JsonResponse|View|Resources\Team { + $validated = $request->validated(); $user = $request->user(); $team = new Team($validated); + if ($request->expectsJson()) { + return (new Resources\Team($team))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $team->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::team/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Team $team, - EditRequest $request - ): JsonResponse|View { + Requests\Team\EditRequest $request + ): JsonResponse|View|Resources\Team { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Team($team))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $team->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $team->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $team->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::team/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Team $team, - DestroyRequest $request + Requests\Team\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $team->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $team->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.teams')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Team $team, - LockRequest $request - ): JsonResponse|RedirectResponse|TeamResource { + Requests\Team\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Team { + $validated = $request->validated(); $user = $request->user(); - $team->setAttribute('locked', true); + if ($user?->id) { + $team->modified_by_id = $user->id; + } + + $team->locked = true; $team->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new TeamResource($team))->response($request); + return (new Resources\Team($team))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.teams.show', ['team' => $team->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['team' => $team->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.teams */ public function index( - IndexRequest $request - ): JsonResponse|View|TeamCollection { + Requests\Team\IndexRequest $request + ): JsonResponse|View|Resources\TeamCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new TeamCollection($paginator))->response($request); + return (new Resources\TeamCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::team/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Team $team, - RestoreRequest $request - ): JsonResponse|RedirectResponse|TeamResource { + Requests\Team\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Team { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $team->modified_by_id = $user->id; + } + $team->restore(); if ($request->expectsJson()) { - return (new TeamResource($team))->response($request); + return (new Resources\Team($team))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.teams.show', ['team' => $team->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['team' => $team->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Team $team, - ShowRequest $request - ): JsonResponse|View|TeamResource { + Requests\Team\ShowRequest $request + ): JsonResponse|View|Resources\Team { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new TeamResource($team))->response($request); + return (new Resources\Team($team))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::team/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.teams.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|TeamResource { + Requests\Team\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Team { + $validated = $request->validated(); $user = $request->user(); $team = new Team($validated); + if ($user?->id) { + $team->created_by_id = $user->id; + } + $team->save(); if ($request->expectsJson()) { - return (new TeamResource($team))->response($request); + return (new Resources\Team($team))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.teams.show', ['team' => $team->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['team' => $team->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Team $team, - UnlockRequest $request - ): JsonResponse|RedirectResponse|TeamResource { + Requests\Team\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Team { + $validated = $request->validated(); $user = $request->user(); - $team->setAttribute('locked', false); + $team->locked = false; + + if ($user?->id) { + $team->modified_by_id = $user->id; + } $team->save(); if ($request->expectsJson()) { - return (new TeamResource($team))->response($request); + return (new Resources\Team($team))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.teams.show', ['team' => $team->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['team' => $team->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Team $team, - UpdateRequest $request - ): JsonResponse|RedirectResponse|TeamResource { + Requests\Team\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Team { + $validated = $request->validated(); $user = $request->user(); $team->update($validated); + if ($user?->id) { + $team->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new TeamResource($team))->response($request); + return (new Resources\Team($team))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.teams.show', ['team' => $team->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['team' => $team->id])); } } diff --git a/src/Http/Controllers/TicketController.php b/src/Http/Controllers/TicketController.php index 36bbbc4..a3172c1 100644 --- a/src/Http/Controllers/TicketController.php +++ b/src/Http/Controllers/TicketController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Ticket', 'model_label_plural' => 'Tickets', 'model_route' => 'playground.matrix.resource.tickets', @@ -50,19 +43,26 @@ class TicketController extends Controller ]; /** - * CREATE the Ticket resource in storage. + * Create the Ticket resource in storage. * * @route GET /resource/matrix/tickets/create playground.matrix.resource.tickets.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Ticket\CreateRequest $request + ): JsonResponse|View|Resources\Ticket { + $validated = $request->validated(); $user = $request->user(); $ticket = new Ticket($validated); + if ($request->expectsJson()) { + return (new Resources\Ticket($ticket))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +80,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $ticket->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +91,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::ticket/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +101,26 @@ public function create( */ public function edit( Ticket $ticket, - EditRequest $request - ): JsonResponse|View { + Requests\Ticket\EditRequest $request + ): JsonResponse|View|Resources\Ticket { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Ticket($ticket))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $ticket->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $ticket->id, @@ -131,23 +138,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $ticket->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::ticket/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +150,17 @@ public function edit( */ public function destroy( Ticket $ticket, - DestroyRequest $request + Requests\Ticket\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $ticket->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $ticket->delete(); } else { @@ -177,7 +177,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.tickets')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +187,18 @@ public function destroy( */ public function lock( Ticket $ticket, - LockRequest $request - ): JsonResponse|RedirectResponse|TicketResource { + Requests\Ticket\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Ticket { + $validated = $request->validated(); $user = $request->user(); - $ticket->setAttribute('locked', true); + if ($user?->id) { + $ticket->modified_by_id = $user->id; + } + + $ticket->locked = true; $ticket->save(); @@ -205,7 +210,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new TicketResource($ticket))->response($request); + return (new Resources\Ticket($ticket))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +221,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.tickets.show', ['ticket' => $ticket->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['ticket' => $ticket->id])); } /** @@ -223,8 +233,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.tickets */ public function index( - IndexRequest $request - ): JsonResponse|View|TicketCollection { + Requests\Ticket\IndexRequest $request + ): JsonResponse|View|Resources\TicketCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +245,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +270,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new TicketCollection($paginator))->response($request); + return (new Resources\TicketCollection($paginator))->response($request); } $meta = [ @@ -284,10 +296,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::ticket/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +306,23 @@ public function index( */ public function restore( Ticket $ticket, - RestoreRequest $request - ): JsonResponse|RedirectResponse|TicketResource { + Requests\Ticket\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Ticket { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $ticket->modified_by_id = $user->id; + } + $ticket->restore(); if ($request->expectsJson()) { - return (new TicketResource($ticket))->response($request); + return (new Resources\Ticket($ticket))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +331,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.tickets.show', ['ticket' => $ticket->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['ticket' => $ticket->id])); } /** @@ -325,8 +344,9 @@ public function restore( */ public function show( Ticket $ticket, - ShowRequest $request - ): JsonResponse|View|TicketResource { + Requests\Ticket\ShowRequest $request + ): JsonResponse|View|Resources\Ticket { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +360,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new TicketResource($ticket))->response($request); + return (new Resources\Ticket($ticket))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +373,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::ticket/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +382,27 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.tickets.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|TicketResource { + Requests\Ticket\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Ticket { + $validated = $request->validated(); $user = $request->user(); $ticket = new Ticket($validated); + if ($user?->id) { + $ticket->created_by_id = $user->id; + } + + $this->handleTicketCode($ticket); + $ticket->save(); if ($request->expectsJson()) { - return (new TicketResource($ticket))->response($request); + return (new Resources\Ticket($ticket))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +411,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.tickets.show', ['ticket' => $ticket->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['ticket' => $ticket->id])); } /** @@ -393,18 +424,25 @@ public function store( */ public function unlock( Ticket $ticket, - UnlockRequest $request - ): JsonResponse|RedirectResponse|TicketResource { + Requests\Ticket\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Ticket { + $validated = $request->validated(); $user = $request->user(); - $ticket->setAttribute('locked', false); + $ticket->locked = false; + + if ($user?->id) { + $ticket->modified_by_id = $user->id; + } $ticket->save(); if ($request->expectsJson()) { - return (new TicketResource($ticket))->response($request); + return (new Resources\Ticket($ticket))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +451,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.tickets.show', ['ticket' => $ticket->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['ticket' => $ticket->id])); } /** @@ -423,16 +464,23 @@ public function unlock( */ public function update( Ticket $ticket, - UpdateRequest $request - ): JsonResponse|RedirectResponse|TicketResource { + Requests\Ticket\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Ticket { + $validated = $request->validated(); $user = $request->user(); $ticket->update($validated); + if ($user?->id) { + $ticket->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new TicketResource($ticket))->response($request); + return (new Resources\Ticket($ticket))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +489,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.tickets.show', ['ticket' => $ticket->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['ticket' => $ticket->id])); } } diff --git a/src/Http/Controllers/VersionController.php b/src/Http/Controllers/VersionController.php index babc3ab..5a95a60 100644 --- a/src/Http/Controllers/VersionController.php +++ b/src/Http/Controllers/VersionController.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Version', 'model_label_plural' => 'Versions', 'model_route' => 'playground.matrix.resource.versions', @@ -50,19 +40,26 @@ class VersionController extends Controller ]; /** - * CREATE the Version resource in storage. + * Create the Version resource in storage. * * @route GET /resource/matrix/versions/create playground.matrix.resource.versions.create */ public function create( - CreateRequest $request - ): JsonResponse|View { + Requests\Version\CreateRequest $request + ): JsonResponse|View|Resources\Version { + $validated = $request->validated(); $user = $request->user(); $version = new Version($validated); + if ($request->expectsJson()) { + return (new Resources\Version($version))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + $meta = [ 'session_user_id' => $user?->id, 'id' => null, @@ -80,10 +77,6 @@ public function create( '_method' => 'post', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - $flash = $version->toArray(); if (! empty($validated['_return_url'])) { @@ -95,10 +88,7 @@ public function create( session()->flashInput($flash); } - return view( - 'playground-matrix-resource::version/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -108,12 +98,26 @@ public function create( */ public function edit( Version $version, - EditRequest $request - ): JsonResponse|View { + Requests\Version\EditRequest $request + ): JsonResponse|View|Resources\Version { + $validated = $request->validated(); $user = $request->user(); + if ($request->expectsJson()) { + return (new Resources\Version($version))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); + } + + $flash = $version->toArray(); + + if (! empty($validated['_return_url'])) { + $flash['_return_url'] = $validated['_return_url']; + $data['_return_url'] = $validated['_return_url']; + } + $meta = [ 'session_user_id' => $user?->id, 'id' => $version->id, @@ -131,23 +135,9 @@ public function edit( '_method' => 'patch', ]; - if ($request->expectsJson()) { - return response()->json($data); - } - - $flash = $version->toArray(); - - if (! empty($validated['_return_url'])) { - $flash['_return_url'] = $validated['_return_url']; - $data['_return_url'] = $validated['_return_url']; - } - session()->flashInput($flash); - return view( - 'playground-matrix-resource::version/form', - $data - ); + return view(sprintf('%1$s/form', $this->packageInfo['view']), $data); } /** @@ -157,10 +147,17 @@ public function edit( */ public function destroy( Version $version, - DestroyRequest $request + Requests\Version\DestroyRequest $request ): Response|RedirectResponse { + $validated = $request->validated(); + $user = $request->user(); + + if ($user?->id) { + $version->modified_by_id = $user->id; + } + if (empty($validated['force'])) { $version->delete(); } else { @@ -177,7 +174,7 @@ public function destroy( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.versions')); + return redirect(route($this->packageInfo['model_route'])); } /** @@ -187,13 +184,18 @@ public function destroy( */ public function lock( Version $version, - LockRequest $request - ): JsonResponse|RedirectResponse|VersionResource { + Requests\Version\LockRequest $request + ): JsonResponse|RedirectResponse|Resources\Version { + $validated = $request->validated(); $user = $request->user(); - $version->setAttribute('locked', true); + if ($user?->id) { + $version->modified_by_id = $user->id; + } + + $version->locked = true; $version->save(); @@ -205,7 +207,9 @@ public function lock( ]; if ($request->expectsJson()) { - return (new VersionResource($version))->response($request); + return (new Resources\Version($version))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -214,7 +218,10 @@ public function lock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.versions.show', ['version' => $version->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['version' => $version->id])); } /** @@ -223,8 +230,9 @@ public function lock( * @route GET /resource/matrix playground.matrix.resource.versions */ public function index( - IndexRequest $request - ): JsonResponse|View { + Requests\Version\IndexRequest $request + ): JsonResponse|View|Resources\VersionCollection { + $user = $request->user(); $validated = $request->validated(); @@ -234,6 +242,7 @@ public function index( $query->sort($validated['sort'] ?? null); if (! empty($validated['filter']) && is_array($validated['filter'])) { + $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -258,12 +267,12 @@ public function index( } $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; - $paginator = $query->paginate( $perPage); + $paginator = $query->paginate($perPage); $paginator->appends($validated); if ($request->expectsJson()) { - return (new VersionCollection($paginator))->response($request); + return (new Resources\VersionCollection($paginator))->response($request); } $meta = [ @@ -284,10 +293,7 @@ public function index( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::version/index', - $data - ); + return view(sprintf('%1$s/index', $this->packageInfo['view']), $data); } /** @@ -297,16 +303,23 @@ public function index( */ public function restore( Version $version, - RestoreRequest $request - ): JsonResponse|RedirectResponse|VersionResource { + Requests\Version\RestoreRequest $request + ): JsonResponse|RedirectResponse|Resources\Version { + $validated = $request->validated(); $user = $request->user(); + if ($user?->id) { + $version->modified_by_id = $user->id; + } + $version->restore(); if ($request->expectsJson()) { - return (new VersionResource($version))->response($request); + return (new Resources\Version($version))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -315,7 +328,10 @@ public function restore( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.versions.show', ['version' => $version->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['version' => $version->id])); } /** @@ -325,8 +341,9 @@ public function restore( */ public function show( Version $version, - ShowRequest $request - ): JsonResponse|View|VersionResource { + Requests\Version\ShowRequest $request + ): JsonResponse|View|Resources\Version { + $validated = $request->validated(); $user = $request->user(); @@ -340,7 +357,9 @@ public function show( ]; if ($request->expectsJson()) { - return (new VersionResource($version))->response($request); + return (new Resources\Version($version))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $meta['input'] = $request->input(); @@ -351,10 +370,7 @@ public function show( 'meta' => $meta, ]; - return view( - 'playground-matrix-resource::version/detail', - $data - ); + return view(sprintf('%1$s/detail', $this->packageInfo['view']), $data); } /** @@ -363,18 +379,25 @@ public function show( * @route POST /resource/matrix playground.matrix.resource.versions.post */ public function store( - StoreRequest $request - ): Response|JsonResponse|RedirectResponse|VersionResource { + Requests\Version\StoreRequest $request + ): Response|JsonResponse|RedirectResponse|Resources\Version { + $validated = $request->validated(); $user = $request->user(); $version = new Version($validated); + if ($user?->id) { + $version->created_by_id = $user->id; + } + $version->save(); if ($request->expectsJson()) { - return (new VersionResource($version))->response($request); + return (new Resources\Version($version))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -383,7 +406,10 @@ public function store( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.versions.show', ['version' => $version->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['version' => $version->id])); } /** @@ -393,18 +419,25 @@ public function store( */ public function unlock( Version $version, - UnlockRequest $request - ): JsonResponse|RedirectResponse|VersionResource { + Requests\Version\UnlockRequest $request + ): JsonResponse|RedirectResponse|Resources\Version { + $validated = $request->validated(); $user = $request->user(); - $version->setAttribute('locked', false); + $version->locked = false; + + if ($user?->id) { + $version->modified_by_id = $user->id; + } $version->save(); if ($request->expectsJson()) { - return (new VersionResource($version))->response($request); + return (new Resources\Version($version))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -413,7 +446,10 @@ public function unlock( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.versions.show', ['version' => $version->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['version' => $version->id])); } /** @@ -423,16 +459,23 @@ public function unlock( */ public function update( Version $version, - UpdateRequest $request - ): JsonResponse|RedirectResponse|VersionResource { + Requests\Version\UpdateRequest $request + ): JsonResponse|RedirectResponse|Resources\Version { + $validated = $request->validated(); $user = $request->user(); $version->update($validated); + if ($user?->id) { + $version->modified_by_id = $user->id; + } + if ($request->expectsJson()) { - return (new VersionResource($version))->response($request); + return (new Resources\Version($version))->additional(['meta' => [ + 'info' => $this->packageInfo, + ]])->response($request); } $returnUrl = $validated['_return_url'] ?? ''; @@ -441,6 +484,9 @@ public function update( return redirect($returnUrl); } - return redirect(route('playground.matrix.resource.versions.show', ['version' => $version->id])); + return redirect(route(sprintf( + '%1$s.show', + $this->packageInfo['model_route'] + ), ['version' => $version->id])); } } diff --git a/src/Http/Requests/Backlog/CreateRequest.php b/src/Http/Requests/Backlog/CreateRequest.php index 29f7e7a..8fff332 100644 --- a/src/Http/Requests/Backlog/CreateRequest.php +++ b/src/Http/Requests/Backlog/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -59,10 +60,22 @@ class CreateRequest extends FormRequest 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'canceled' => ['boolean'], 'closed' => ['boolean'], 'completed' => ['boolean'], + 'cron' => ['boolean'], 'duplicate' => ['boolean'], 'fixed' => ['boolean'], 'flagged' => ['boolean'], diff --git a/src/Http/Requests/Backlog/DestroyRequest.php b/src/Http/Requests/Backlog/DestroyRequest.php index f3b483a..938527b 100644 --- a/src/Http/Requests/Backlog/DestroyRequest.php +++ b/src/Http/Requests/Backlog/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -59,10 +60,22 @@ class EditRequest extends FormRequest 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'canceled' => ['boolean'], 'closed' => ['boolean'], 'completed' => ['boolean'], + 'cron' => ['boolean'], 'duplicate' => ['boolean'], 'fixed' => ['boolean'], 'flagged' => ['boolean'], diff --git a/src/Http/Requests/Backlog/IndexRequest.php b/src/Http/Requests/Backlog/IndexRequest.php index fbefa2d..0a47480 100644 --- a/src/Http/Requests/Backlog/IndexRequest.php +++ b/src/Http/Requests/Backlog/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => true], @@ -37,13 +37,14 @@ class IndexRequest extends BaseIndexRequest ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], @@ -61,7 +62,7 @@ class IndexRequest extends BaseIndexRequest ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], @@ -73,6 +74,7 @@ class IndexRequest extends BaseIndexRequest 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'uuid', 'nullable' => true], 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'uuid', 'nullable' => true], 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'uuid', 'nullable' => true], 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => true], 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'uuid', 'nullable' => true], @@ -87,7 +89,7 @@ class IndexRequest extends BaseIndexRequest ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], @@ -102,7 +104,7 @@ class IndexRequest extends BaseIndexRequest ]; /** - * @var array + * @var array> */ protected array $sortable = [ 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'string'], @@ -114,6 +116,7 @@ class IndexRequest extends BaseIndexRequest 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'string'], 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'string'], 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'string'], 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'string'], 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'string'], @@ -153,10 +156,22 @@ class IndexRequest extends BaseIndexRequest 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'type' => 'boolean'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'type' => 'boolean'], 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'type' => 'boolean'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], @@ -183,5 +198,15 @@ class IndexRequest extends BaseIndexRequest 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'backlog' => ['column' => 'backlog', 'label' => 'Backlog', 'type' => 'JSON_OBJECT'], + 'board' => ['column' => 'board', 'label' => 'Board', 'type' => 'JSON_OBJECT'], + 'flow' => ['column' => 'flow', 'label' => 'Flow', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'roadmap' => ['column' => 'roadmap', 'label' => 'Roadmap', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Backlog/LockRequest.php b/src/Http/Requests/Backlog/LockRequest.php index fdcea4e..bd0f901 100644 --- a/src/Http/Requests/Backlog/LockRequest.php +++ b/src/Http/Requests/Backlog/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -59,10 +60,22 @@ class StoreRequest extends BaseStoreRequest 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'canceled' => ['boolean'], 'closed' => ['boolean'], 'completed' => ['boolean'], + 'cron' => ['boolean'], 'duplicate' => ['boolean'], 'fixed' => ['boolean'], 'flagged' => ['boolean'], @@ -78,7 +91,7 @@ class StoreRequest extends BaseStoreRequest 'suspended' => ['boolean'], 'unknown' => ['boolean'], 'label' => ['string'], - 'title' => ['string'], + 'title' => ['string', 'required'], 'byline' => ['string'], 'slug' => ['nullable', 'string'], 'url' => ['string'], @@ -101,8 +114,6 @@ class StoreRequest extends BaseStoreRequest '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_backlogs'; - /** * Prepare the data for validation. * @@ -114,38 +125,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Backlog/UnlockRequest.php b/src/Http/Requests/Backlog/UnlockRequest.php index 1f47a6f..3f599f9 100644 --- a/src/Http/Requests/Backlog/UnlockRequest.php +++ b/src/Http/Requests/Backlog/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -59,10 +60,22 @@ class UpdateRequest extends BaseUpdateRequest 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'canceled' => ['boolean'], 'closed' => ['boolean'], 'completed' => ['boolean'], + 'cron' => ['boolean'], 'duplicate' => ['boolean'], 'fixed' => ['boolean'], 'flagged' => ['boolean'], @@ -78,7 +91,7 @@ class UpdateRequest extends BaseUpdateRequest 'suspended' => ['boolean'], 'unknown' => ['boolean'], 'label' => ['string'], - 'title' => ['string'], + 'title' => ['string', 'required'], 'byline' => ['string'], 'slug' => ['nullable', 'string'], 'url' => ['string'], @@ -101,8 +114,6 @@ class UpdateRequest extends BaseUpdateRequest '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_backlogs'; - /** * Prepare the data for validation. * @@ -114,38 +125,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Board/CreateRequest.php b/src/Http/Requests/Board/CreateRequest.php index 52a9fc8..86e5395 100644 --- a/src/Http/Requests/Board/CreateRequest.php +++ b/src/Http/Requests/Board/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'board_type' => ['nullable', 'string'], + 'backlog_id' => ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -33,22 +35,49 @@ class CreateRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'fixed_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'resolved_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -56,37 +85,29 @@ class CreateRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], 'backlog' => ['nullable', 'array'], 'board' => ['nullable', 'array'], 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Board/DestroyRequest.php b/src/Http/Requests/Board/DestroyRequest.php index 7d5caab..604a6fc 100644 --- a/src/Http/Requests/Board/DestroyRequest.php +++ b/src/Http/Requests/Board/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'board_type' => ['nullable', 'string'], + 'backlog_id' => ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -33,22 +35,49 @@ class EditRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'fixed_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'resolved_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -56,37 +85,29 @@ class EditRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], 'backlog' => ['nullable', 'array'], 'board' => ['nullable', 'array'], 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Board/IndexRequest.php b/src/Http/Requests/Board/IndexRequest.php index 7d8b417..709e993 100644 --- a/src/Http/Requests/Board/IndexRequest.php +++ b/src/Http/Requests/Board/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], - 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated at', 'nullable' => true], 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], @@ -37,13 +37,14 @@ class IndexRequest extends BaseIndexRequest ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], @@ -58,48 +59,152 @@ class IndexRequest extends BaseIndexRequest 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created By Id', 'type' => 'uuid', 'nullable' => false], - 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'board_type' => ['column' => 'board_type', 'label' => 'Board Type', 'type' => 'string', 'nullable' => true], - 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'uuid', 'nullable' => false], - 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => false], - 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'uuid', 'nullable' => false], - 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => false], - 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'uuid', 'nullable' => false], - 'release_id' => ['column' => 'release_id', 'label' => 'Release Id', 'type' => 'uuid', 'nullable' => false], - 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap Id', 'type' => 'uuid', 'nullable' => false], - 'source_id' => ['column' => 'source_id', 'label' => 'Source Id', 'type' => 'uuid', 'nullable' => false], - 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint Id', 'type' => 'uuid', 'nullable' => false], - 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag Id', 'type' => 'uuid', 'nullable' => false], - 'team_id' => ['column' => 'team_id', 'label' => 'Team Id', 'type' => 'uuid', 'nullable' => false], - 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket Id', 'type' => 'uuid', 'nullable' => false], - 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'uuid', 'nullable' => true], + 'board_type' => ['column' => 'board_type', 'label' => 'Board type', 'type' => 'string', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'uuid', 'nullable' => true], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'uuid', 'nullable' => true], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'uuid', 'nullable' => true], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'uuid', 'nullable' => true], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'uuid', 'nullable' => true], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'uuid', 'nullable' => true], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'uuid', 'nullable' => true], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'uuid', 'nullable' => true], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'uuid', 'nullable' => true], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'uuid', 'nullable' => true], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'uuid', 'nullable' => true], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'uuid', 'nullable' => true], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'uuid', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'board_type' => ['column' => 'board_type', 'label' => 'Board type', 'type' => 'string'], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'string'], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'string'], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'string'], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'string'], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'string'], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'string'], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'string'], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'string'], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'string'], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'string'], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'string'], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'string'], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'start_at' => ['column' => 'start_at', 'label' => 'Start at', 'type' => 'string'], + 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned start at', 'type' => 'string'], + 'end_at' => ['column' => 'end_at', 'label' => 'End at', 'type' => 'string'], + 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned end at', 'type' => 'string'], + 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled at', 'type' => 'string'], + 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed at', 'type' => 'string'], + 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo at', 'type' => 'string'], + 'fixed_at' => ['column' => 'fixed_at', 'label' => 'Fixed at', 'type' => 'string'], + 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed at', 'type' => 'string'], + 'published_at' => ['column' => 'published_at', 'label' => 'Published at', 'type' => 'string'], + 'released_at' => ['column' => 'released_at', 'label' => 'Released at', 'type' => 'string'], + 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed at', 'type' => 'string'], + 'resolved_at' => ['column' => 'resolved_at', 'label' => 'Resolved at', 'type' => 'string'], + 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended at', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], + 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], + 'completed' => ['column' => 'completed', 'label' => 'Completed', 'type' => 'boolean'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], + 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'type' => 'boolean'], + 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], + 'published' => ['column' => 'published', 'label' => 'Published', 'type' => 'boolean'], + 'released' => ['column' => 'released', 'label' => 'Released', 'type' => 'boolean'], + 'retired' => ['column' => 'retired', 'label' => 'Retired', 'type' => 'boolean'], + 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'type' => 'boolean'], + 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'backlog' => ['column' => 'backlog', 'label' => 'Backlog', 'type' => 'JSON_OBJECT'], + 'board' => ['column' => 'board', 'label' => 'Board', 'type' => 'JSON_OBJECT'], + 'flow' => ['column' => 'flow', 'label' => 'Flow', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'roadmap' => ['column' => 'roadmap', 'label' => 'Roadmap', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Board/LockRequest.php b/src/Http/Requests/Board/LockRequest.php index 0a3d7a6..bba7851 100644 --- a/src/Http/Requests/Board/LockRequest.php +++ b/src/Http/Requests/Board/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'board_type' => ['nullable', 'string'], + 'backlog_id' => ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -33,22 +35,49 @@ class StoreRequest extends BaseStoreRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'fixed_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'resolved_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -56,45 +85,35 @@ class StoreRequest extends BaseStoreRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], 'backlog' => ['nullable', 'array'], 'board' => ['nullable', 'array'], 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_boards'; - /** * Prepare the data for validation. * @@ -106,38 +125,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Board/UnlockRequest.php b/src/Http/Requests/Board/UnlockRequest.php index c4376ac..5bebb72 100644 --- a/src/Http/Requests/Board/UnlockRequest.php +++ b/src/Http/Requests/Board/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'board_type' => ['nullable', 'string'], + 'backlog_id' => ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -33,22 +35,49 @@ class UpdateRequest extends BaseUpdateRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'fixed_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'resolved_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -56,45 +85,35 @@ class UpdateRequest extends BaseUpdateRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], 'backlog' => ['nullable', 'array'], 'board' => ['nullable', 'array'], 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_boards'; - /** * Prepare the data for validation. * @@ -106,38 +125,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Epic/CreateRequest.php b/src/Http/Requests/Epic/CreateRequest.php index 8261f1d..b6dbed5 100644 --- a/src/Http/Requests/Epic/CreateRequest.php +++ b/src/Http/Requests/Epic/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'epic_type' => ['nullable', 'string'], + 'backlog_id' => ['nullable', 'uuid'], 'board_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -33,22 +35,49 @@ class CreateRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'fixed_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'resolved_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -56,37 +85,29 @@ class CreateRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Epic/DestroyRequest.php b/src/Http/Requests/Epic/DestroyRequest.php index b8514f5..ab84ce3 100644 --- a/src/Http/Requests/Epic/DestroyRequest.php +++ b/src/Http/Requests/Epic/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'epic_type' => ['nullable', 'string'], + 'backlog_id' => ['nullable', 'uuid'], 'board_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -33,22 +35,49 @@ class EditRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'fixed_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'resolved_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -56,37 +85,29 @@ class EditRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Epic/IndexRequest.php b/src/Http/Requests/Epic/IndexRequest.php index 7ab14c2..63ae111 100644 --- a/src/Http/Requests/Epic/IndexRequest.php +++ b/src/Http/Requests/Epic/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], - 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated at', 'nullable' => true], 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], @@ -37,13 +37,14 @@ class IndexRequest extends BaseIndexRequest ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], @@ -58,46 +59,152 @@ class IndexRequest extends BaseIndexRequest 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'epic_type' => ['column' => 'epic_type', 'label' => 'Epic Type', 'type' => 'string', 'nullable' => true], - 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'uuid', 'nullable' => false], - 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => false], - 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'uuid', 'nullable' => false], - 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => false], - 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'uuid', 'nullable' => false], - 'release_id' => ['column' => 'release_id', 'label' => 'Release Id', 'type' => 'uuid', 'nullable' => false], - 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap Id', 'type' => 'uuid', 'nullable' => false], - 'source_id' => ['column' => 'source_id', 'label' => 'Source Id', 'type' => 'uuid', 'nullable' => false], - 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint Id', 'type' => 'uuid', 'nullable' => false], - 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag Id', 'type' => 'uuid', 'nullable' => false], - 'team_id' => ['column' => 'team_id', 'label' => 'Team Id', 'type' => 'uuid', 'nullable' => false], - 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket Id', 'type' => 'uuid', 'nullable' => false], - 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'uuid', 'nullable' => true], + 'epic_type' => ['column' => 'epic_type', 'label' => 'Epic type', 'type' => 'string', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'uuid', 'nullable' => true], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'uuid', 'nullable' => true], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'uuid', 'nullable' => true], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'uuid', 'nullable' => true], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'uuid', 'nullable' => true], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'uuid', 'nullable' => true], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'uuid', 'nullable' => true], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'uuid', 'nullable' => true], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'uuid', 'nullable' => true], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'uuid', 'nullable' => true], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'uuid', 'nullable' => true], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'uuid', 'nullable' => true], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'uuid', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'epic_type' => ['column' => 'epic_type', 'label' => 'Epic type', 'type' => 'string'], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'string'], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'string'], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'string'], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'string'], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'string'], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'string'], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'string'], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'string'], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'string'], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'string'], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'string'], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'string'], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'start_at' => ['column' => 'start_at', 'label' => 'Start at', 'type' => 'string'], + 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned start at', 'type' => 'string'], + 'end_at' => ['column' => 'end_at', 'label' => 'End at', 'type' => 'string'], + 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned end at', 'type' => 'string'], + 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled at', 'type' => 'string'], + 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed at', 'type' => 'string'], + 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo at', 'type' => 'string'], + 'fixed_at' => ['column' => 'fixed_at', 'label' => 'Fixed at', 'type' => 'string'], + 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed at', 'type' => 'string'], + 'published_at' => ['column' => 'published_at', 'label' => 'Published at', 'type' => 'string'], + 'released_at' => ['column' => 'released_at', 'label' => 'Released at', 'type' => 'string'], + 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed at', 'type' => 'string'], + 'resolved_at' => ['column' => 'resolved_at', 'label' => 'Resolved at', 'type' => 'string'], + 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended at', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], + 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], + 'completed' => ['column' => 'completed', 'label' => 'Completed', 'type' => 'boolean'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], + 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'type' => 'boolean'], + 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], + 'published' => ['column' => 'published', 'label' => 'Published', 'type' => 'boolean'], + 'released' => ['column' => 'released', 'label' => 'Released', 'type' => 'boolean'], + 'retired' => ['column' => 'retired', 'label' => 'Retired', 'type' => 'boolean'], + 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'type' => 'boolean'], + 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'backlog' => ['column' => 'backlog', 'label' => 'Backlog', 'type' => 'JSON_OBJECT'], + 'board' => ['column' => 'board', 'label' => 'Board', 'type' => 'JSON_OBJECT'], + 'flow' => ['column' => 'flow', 'label' => 'Flow', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'roadmap' => ['column' => 'roadmap', 'label' => 'Roadmap', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Epic/LockRequest.php b/src/Http/Requests/Epic/LockRequest.php index ad3543b..5cb6e5d 100644 --- a/src/Http/Requests/Epic/LockRequest.php +++ b/src/Http/Requests/Epic/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'epic_type' => ['nullable', 'string'], + 'backlog_id' => ['nullable', 'uuid'], 'board_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -33,22 +35,49 @@ class StoreRequest extends BaseStoreRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'fixed_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'resolved_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -56,45 +85,35 @@ class StoreRequest extends BaseStoreRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_epics'; - /** * Prepare the data for validation. * @@ -106,38 +125,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Epic/UnlockRequest.php b/src/Http/Requests/Epic/UnlockRequest.php index 8aab98c..347999a 100644 --- a/src/Http/Requests/Epic/UnlockRequest.php +++ b/src/Http/Requests/Epic/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'epic_type' => ['nullable', 'string'], + 'backlog_id' => ['nullable', 'uuid'], 'board_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -33,22 +35,49 @@ class UpdateRequest extends BaseUpdateRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'fixed_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'resolved_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -56,45 +85,35 @@ class UpdateRequest extends BaseUpdateRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_epics'; - /** * Prepare the data for validation. * @@ -106,38 +125,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Flow/CreateRequest.php b/src/Http/Requests/Flow/CreateRequest.php index 67c0ef4..df6a9fa 100644 --- a/src/Http/Requests/Flow/CreateRequest.php +++ b/src/Http/Requests/Flow/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'flow_type' => ['nullable', 'string'], + 'matrix_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'tag_id' => ['nullable', 'uuid'], 'team_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], + 'roadmap' => ['nullable', 'array'], + 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; } diff --git a/src/Http/Requests/Flow/DestroyRequest.php b/src/Http/Requests/Flow/DestroyRequest.php index 6f6dfe1..84389b6 100644 --- a/src/Http/Requests/Flow/DestroyRequest.php +++ b/src/Http/Requests/Flow/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'flow_type' => ['nullable', 'string'], + 'matrix_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'tag_id' => ['nullable', 'uuid'], 'team_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], + 'roadmap' => ['nullable', 'array'], + 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; } diff --git a/src/Http/Requests/Flow/IndexRequest.php b/src/Http/Requests/Flow/IndexRequest.php index 1ff783c..633c159 100644 --- a/src/Http/Requests/Flow/IndexRequest.php +++ b/src/Http/Requests/Flow/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], - 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated at', 'nullable' => true], 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned End At', 'nullable' => true], - 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled At', 'nullable' => true], - 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed At', 'nullable' => true], 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo At', 'nullable' => true], 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed At', 'nullable' => true], - 'published_at' => ['column' => 'published_at', 'label' => 'Published At', 'nullable' => true], - 'released_at' => ['column' => 'released_at', 'label' => 'Released At', 'nullable' => true], 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed At', 'nullable' => true], 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended At', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], - 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], - 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], - 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], - 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], - 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], 'internal' => ['column' => 'internal', 'label' => 'Internal', 'icon' => 'fa-solid fa-server'], 'locked' => ['column' => 'locked', 'label' => 'Locked', 'icon' => 'fa-solid fa-lock text-warning'], 'pending' => ['column' => 'pending', 'label' => 'Pending', 'icon' => 'fa-solid fa-circle-pause text-warning'], 'planned' => ['column' => 'planned', 'label' => 'Planned', 'icon' => 'fa-solid fa-circle-pause text-success'], 'problem' => ['column' => 'problem', 'label' => 'Problem', 'icon' => 'fa-solid fa-triangle-exclamation text-danger'], - 'published' => ['column' => 'published', 'label' => 'Published', 'icon' => 'fa-solid fa-book'], - 'released' => ['column' => 'released', 'label' => 'Released', 'icon' => 'fa-solid fa-dove'], 'retired' => ['column' => 'retired', 'label' => 'Retired', 'icon' => 'fa-solid fa-chair text-success'], - 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'flow_type' => ['column' => 'flow_type', 'label' => 'Flow Type', 'type' => 'string', 'nullable' => true], - 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => false], - 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag Id', 'type' => 'uuid', 'nullable' => false], - 'team_id' => ['column' => 'team_id', 'label' => 'Team Id', 'type' => 'uuid', 'nullable' => false], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'uuid', 'nullable' => true], + 'flow_type' => ['column' => 'flow_type', 'label' => 'Flow type', 'type' => 'string', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'uuid', 'nullable' => true], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'uuid', 'nullable' => true], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'uuid', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'flow_type' => ['column' => 'flow_type', 'label' => 'Flow type', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'string'], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'string'], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'start_at' => ['column' => 'start_at', 'label' => 'Start at', 'type' => 'string'], + 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned start at', 'type' => 'string'], + 'end_at' => ['column' => 'end_at', 'label' => 'End at', 'type' => 'string'], + 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned end at', 'type' => 'string'], + 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo at', 'type' => 'string'], + 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed at', 'type' => 'string'], + 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed at', 'type' => 'string'], + 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended at', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], + 'retired' => ['column' => 'retired', 'label' => 'Retired', 'type' => 'boolean'], + 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'backlog' => ['column' => 'backlog', 'label' => 'Backlog', 'type' => 'JSON_OBJECT'], + 'board' => ['column' => 'board', 'label' => 'Board', 'type' => 'JSON_OBJECT'], + 'flow' => ['column' => 'flow', 'label' => 'Flow', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'roadmap' => ['column' => 'roadmap', 'label' => 'Roadmap', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Flow/LockRequest.php b/src/Http/Requests/Flow/LockRequest.php index 9b41f22..d39b8eb 100644 --- a/src/Http/Requests/Flow/LockRequest.php +++ b/src/Http/Requests/Flow/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'flow_type' => ['nullable', 'string'], + 'matrix_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'tag_id' => ['nullable', 'uuid'], 'team_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], + 'roadmap' => ['nullable', 'array'], + 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_flows'; - /** * Prepare the data for validation. * @@ -90,38 +100,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Flow/UnlockRequest.php b/src/Http/Requests/Flow/UnlockRequest.php index 6f82795..5c59fe8 100644 --- a/src/Http/Requests/Flow/UnlockRequest.php +++ b/src/Http/Requests/Flow/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'flow_type' => ['nullable', 'string'], + 'matrix_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'tag_id' => ['nullable', 'uuid'], 'team_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], + 'roadmap' => ['nullable', 'array'], + 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_flows'; - /** * Prepare the data for validation. * @@ -90,38 +100,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/FormRequest.php b/src/Http/Requests/FormRequest.php index 7e861bd..1a7b67c 100644 --- a/src/Http/Requests/FormRequest.php +++ b/src/Http/Requests/FormRequest.php @@ -1,9 +1,9 @@ > diff --git a/src/Http/Requests/Index/IndexRequest.php b/src/Http/Requests/Index/IndexRequest.php new file mode 100644 index 0000000..add02c2 --- /dev/null +++ b/src/Http/Requests/Index/IndexRequest.php @@ -0,0 +1,16 @@ +> + */ + public const RULES = [ + 'owned_by_id' => ['nullable', 'uuid'], + 'parent_id' => ['nullable', 'uuid'], + 'matrix_type' => ['nullable', 'string'], + 'matrix_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], + 'gids' => ['integer'], + 'po' => ['integer'], + 'pg' => ['integer'], + 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], + 'status' => ['integer'], + 'rank' => ['integer'], + 'size' => ['integer'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], + 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'flagged' => ['boolean'], + 'internal' => ['boolean'], + 'locked' => ['boolean'], + 'pending' => ['boolean'], + 'planned' => ['boolean'], + 'problem' => ['boolean'], + 'retired' => ['boolean'], + 'suspended' => ['boolean'], + 'unknown' => ['boolean'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], + 'icon' => ['string'], + 'image' => ['string'], + 'avatar' => ['string'], + 'ui' => ['nullable', 'array'], + 'assets' => ['nullable', 'array'], + 'meta' => ['nullable', 'array'], + 'options' => ['nullable', 'array'], + 'sources' => ['nullable', 'array'], + '_return_url' => ['nullable', 'url'], + ]; +} diff --git a/src/Http/Requests/Matrix/DestroyRequest.php b/src/Http/Requests/Matrix/DestroyRequest.php new file mode 100644 index 0000000..d04ddd9 --- /dev/null +++ b/src/Http/Requests/Matrix/DestroyRequest.php @@ -0,0 +1,40 @@ +> + */ + public const RULES = [ + '_return_url' => ['nullable', 'url'], + ]; + + /** + * Get the validation rules that apply to the request. + * + * @return array|string> + */ + public function rules(): array + { + $rules = parent::rules(); + + $user = $this->user(); + + if ($this->userHasAdminPrivileges($user)) { + $rules['force'] = ['boolean']; + } + + return $rules; + } +} diff --git a/src/Http/Requests/Matrix/EditRequest.php b/src/Http/Requests/Matrix/EditRequest.php new file mode 100644 index 0000000..128d6eb --- /dev/null +++ b/src/Http/Requests/Matrix/EditRequest.php @@ -0,0 +1,89 @@ +> + */ + public const RULES = [ + 'owned_by_id' => ['nullable', 'uuid'], + 'parent_id' => ['nullable', 'uuid'], + 'matrix_type' => ['nullable', 'string'], + 'matrix_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], + 'gids' => ['integer'], + 'po' => ['integer'], + 'pg' => ['integer'], + 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], + 'status' => ['integer'], + 'rank' => ['integer'], + 'size' => ['integer'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], + 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'flagged' => ['boolean'], + 'internal' => ['boolean'], + 'locked' => ['boolean'], + 'pending' => ['boolean'], + 'planned' => ['boolean'], + 'problem' => ['boolean'], + 'retired' => ['boolean'], + 'suspended' => ['boolean'], + 'unknown' => ['boolean'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], + 'icon' => ['string'], + 'image' => ['string'], + 'avatar' => ['string'], + 'ui' => ['nullable', 'array'], + 'assets' => ['nullable', 'array'], + 'meta' => ['nullable', 'array'], + 'options' => ['nullable', 'array'], + 'sources' => ['nullable', 'array'], + '_return_url' => ['nullable', 'url'], + ]; +} diff --git a/src/Http/Requests/Matrix/IndexRequest.php b/src/Http/Requests/Matrix/IndexRequest.php new file mode 100644 index 0000000..2ed1f24 --- /dev/null +++ b/src/Http/Requests/Matrix/IndexRequest.php @@ -0,0 +1,154 @@ +> + */ + protected array $paginationDates = [ + 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], + 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], + 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], + 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned End At', 'nullable' => true], + 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled At', 'nullable' => true], + 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed At', 'nullable' => true], + 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo At', 'nullable' => true], + 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed At', 'nullable' => true], + 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed At', 'nullable' => true], + 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended At', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $paginationFlags = [ + 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], + 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], + 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], + 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'icon' => 'fa-solid fa-server'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'icon' => 'fa-solid fa-lock text-warning'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'icon' => 'fa-solid fa-circle-pause text-warning'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'icon' => 'fa-solid fa-circle-pause text-success'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'icon' => 'fa-solid fa-triangle-exclamation text-danger'], + 'retired' => ['column' => 'retired', 'label' => 'Retired', 'icon' => 'fa-solid fa-chair text-success'], + 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], + ]; + + /** + * @var array> + */ + protected array $paginationIds = [ + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'matrix_type' => ['column' => 'matrix_type', 'label' => 'Matrix type', 'type' => 'string', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $paginationColumns = [ + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'matrix_type' => ['column' => 'matrix_type', 'label' => 'Matrix type', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'start_at' => ['column' => 'start_at', 'label' => 'Start at', 'type' => 'string'], + 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned start at', 'type' => 'string'], + 'end_at' => ['column' => 'end_at', 'label' => 'End at', 'type' => 'string'], + 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned end at', 'type' => 'string'], + 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled at', 'type' => 'string'], + 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed at', 'type' => 'string'], + 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo at', 'type' => 'string'], + 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed at', 'type' => 'string'], + 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed at', 'type' => 'string'], + 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended at', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], + 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], + 'completed' => ['column' => 'completed', 'label' => 'Completed', 'type' => 'boolean'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], + 'retired' => ['column' => 'retired', 'label' => 'Retired', 'type' => 'boolean'], + 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], + ]; +} diff --git a/src/Http/Requests/Matrix/LockRequest.php b/src/Http/Requests/Matrix/LockRequest.php new file mode 100644 index 0000000..8402eb1 --- /dev/null +++ b/src/Http/Requests/Matrix/LockRequest.php @@ -0,0 +1,22 @@ +> + */ + public const RULES = [ + '_return_url' => ['nullable', 'url'], + ]; +} diff --git a/src/Http/Requests/Matrix/RestoreRequest.php b/src/Http/Requests/Matrix/RestoreRequest.php new file mode 100644 index 0000000..60c8028 --- /dev/null +++ b/src/Http/Requests/Matrix/RestoreRequest.php @@ -0,0 +1,22 @@ +> + */ + public const RULES = [ + '_return_url' => ['nullable', 'url'], + ]; +} diff --git a/src/Http/Requests/Matrix/ShowRequest.php b/src/Http/Requests/Matrix/ShowRequest.php new file mode 100644 index 0000000..6b545f5 --- /dev/null +++ b/src/Http/Requests/Matrix/ShowRequest.php @@ -0,0 +1,16 @@ +> + */ + public const RULES = [ + 'owned_by_id' => ['nullable', 'uuid'], + 'parent_id' => ['nullable', 'uuid'], + 'matrix_type' => ['nullable', 'string'], + 'matrix_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], + 'gids' => ['integer'], + 'po' => ['integer'], + 'pg' => ['integer'], + 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], + 'status' => ['integer'], + 'rank' => ['integer'], + 'size' => ['integer'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], + 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'flagged' => ['boolean'], + 'internal' => ['boolean'], + 'locked' => ['boolean'], + 'pending' => ['boolean'], + 'planned' => ['boolean'], + 'problem' => ['boolean'], + 'retired' => ['boolean'], + 'suspended' => ['boolean'], + 'unknown' => ['boolean'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], + 'icon' => ['string'], + 'image' => ['string'], + 'avatar' => ['string'], + 'ui' => ['nullable', 'array'], + 'assets' => ['nullable', 'array'], + 'meta' => ['nullable', 'array'], + 'options' => ['nullable', 'array'], + 'sources' => ['nullable', 'array'], + '_return_url' => ['nullable', 'url'], + ]; + + /** + * Prepare the data for validation. + * + * @return void + */ + protected function prepareForValidation() + { + parent::prepareForValidation(); + + $input = []; + + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); + + if (! empty($input)) { + $this->merge($input); + } + } +} diff --git a/src/Http/Requests/Matrix/UnlockRequest.php b/src/Http/Requests/Matrix/UnlockRequest.php new file mode 100644 index 0000000..8b9831a --- /dev/null +++ b/src/Http/Requests/Matrix/UnlockRequest.php @@ -0,0 +1,22 @@ +> + */ + public const RULES = [ + '_return_url' => ['nullable', 'url'], + ]; +} diff --git a/src/Http/Requests/Matrix/UpdateRequest.php b/src/Http/Requests/Matrix/UpdateRequest.php new file mode 100644 index 0000000..7c81b42 --- /dev/null +++ b/src/Http/Requests/Matrix/UpdateRequest.php @@ -0,0 +1,110 @@ +> + */ + public const RULES = [ + 'owned_by_id' => ['nullable', 'uuid'], + 'parent_id' => ['nullable', 'uuid'], + 'matrix_type' => ['nullable', 'string'], + 'matrix_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], + 'gids' => ['integer'], + 'po' => ['integer'], + 'pg' => ['integer'], + 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], + 'status' => ['integer'], + 'rank' => ['integer'], + 'size' => ['integer'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], + 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'flagged' => ['boolean'], + 'internal' => ['boolean'], + 'locked' => ['boolean'], + 'pending' => ['boolean'], + 'planned' => ['boolean'], + 'problem' => ['boolean'], + 'retired' => ['boolean'], + 'suspended' => ['boolean'], + 'unknown' => ['boolean'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], + 'icon' => ['string'], + 'image' => ['string'], + 'avatar' => ['string'], + 'ui' => ['nullable', 'array'], + 'assets' => ['nullable', 'array'], + 'meta' => ['nullable', 'array'], + 'options' => ['nullable', 'array'], + 'sources' => ['nullable', 'array'], + '_return_url' => ['nullable', 'url'], + ]; + + /** + * Prepare the data for validation. + * + * @return void + */ + protected function prepareForValidation() + { + parent::prepareForValidation(); + + $input = []; + + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); + + if (! empty($input)) { + $this->merge($input); + } + } +} diff --git a/src/Http/Requests/Milestone/CreateRequest.php b/src/Http/Requests/Milestone/CreateRequest.php index b836773..408c9dd 100644 --- a/src/Http/Requests/Milestone/CreateRequest.php +++ b/src/Http/Requests/Milestone/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], 'release_id' => ['nullable', 'uuid'], @@ -34,22 +35,47 @@ class CreateRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,37 +83,29 @@ class CreateRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Milestone/DestroyRequest.php b/src/Http/Requests/Milestone/DestroyRequest.php index f6fb287..637fbb3 100644 --- a/src/Http/Requests/Milestone/DestroyRequest.php +++ b/src/Http/Requests/Milestone/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], 'release_id' => ['nullable', 'uuid'], @@ -34,22 +35,47 @@ class EditRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,37 +83,29 @@ class EditRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Milestone/IndexRequest.php b/src/Http/Requests/Milestone/IndexRequest.php index 6e169b2..16cbfff 100644 --- a/src/Http/Requests/Milestone/IndexRequest.php +++ b/src/Http/Requests/Milestone/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => true], 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], @@ -27,23 +27,22 @@ class IndexRequest extends BaseIndexRequest 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled At', 'nullable' => true], 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed At', 'nullable' => true], 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo At', 'nullable' => true], - 'fixed_at' => ['column' => 'fixed_at', 'label' => 'Fixed At', 'nullable' => true], 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed At', 'nullable' => true], 'published_at' => ['column' => 'published_at', 'label' => 'Published At', 'nullable' => true], 'released_at' => ['column' => 'released_at', 'label' => 'Released At', 'nullable' => true], 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed At', 'nullable' => true], - 'resolved_at' => ['column' => 'resolved_at', 'label' => 'Resolved At', 'nullable' => true], 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended At', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], @@ -58,47 +57,150 @@ class IndexRequest extends BaseIndexRequest 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'milestone_type' => ['column' => 'milestone_type', 'label' => 'Milestone Type', 'type' => 'string', 'nullable' => true], - 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog Id', 'type' => 'uuid', 'nullable' => false], - 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'uuid', 'nullable' => false], - 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'uuid', 'nullable' => false], - 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => false], - 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => false], - 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'uuid', 'nullable' => false], - 'release_id' => ['column' => 'release_id', 'label' => 'Release Id', 'type' => 'uuid', 'nullable' => false], - 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap Id', 'type' => 'uuid', 'nullable' => false], - 'source_id' => ['column' => 'source_id', 'label' => 'Source Id', 'type' => 'uuid', 'nullable' => false], - 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint Id', 'type' => 'uuid', 'nullable' => false], - 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag Id', 'type' => 'uuid', 'nullable' => false], - 'team_id' => ['column' => 'team_id', 'label' => 'Team Id', 'type' => 'uuid', 'nullable' => false], - 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket Id', 'type' => 'uuid', 'nullable' => false], - 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'uuid', 'nullable' => true], + 'milestone_type' => ['column' => 'milestone_type', 'label' => 'Milestone type', 'type' => 'string', 'nullable' => true], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'uuid', 'nullable' => true], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'uuid', 'nullable' => true], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'uuid', 'nullable' => true], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'uuid', 'nullable' => true], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'uuid', 'nullable' => true], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'uuid', 'nullable' => true], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'uuid', 'nullable' => true], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'uuid', 'nullable' => true], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'uuid', 'nullable' => true], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'uuid', 'nullable' => true], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'uuid', 'nullable' => true], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'uuid', 'nullable' => true], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'uuid', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'milestone_type' => ['column' => 'milestone_type', 'label' => 'Milestone type', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'string'], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'string'], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'start_at' => ['column' => 'start_at', 'label' => 'Start at', 'type' => 'string'], + 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned start at', 'type' => 'string'], + 'end_at' => ['column' => 'end_at', 'label' => 'End at', 'type' => 'string'], + 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned end at', 'type' => 'string'], + 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled at', 'type' => 'string'], + 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed at', 'type' => 'string'], + 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo at', 'type' => 'string'], + 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed at', 'type' => 'string'], + 'published_at' => ['column' => 'published_at', 'label' => 'Published at', 'type' => 'string'], + 'released_at' => ['column' => 'released_at', 'label' => 'Released at', 'type' => 'string'], + 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed at', 'type' => 'string'], + 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended at', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], + 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], + 'completed' => ['column' => 'completed', 'label' => 'Completed', 'type' => 'boolean'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], + 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'type' => 'boolean'], + 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], + 'published' => ['column' => 'published', 'label' => 'Published', 'type' => 'boolean'], + 'released' => ['column' => 'released', 'label' => 'Released', 'type' => 'boolean'], + 'retired' => ['column' => 'retired', 'label' => 'Retired', 'type' => 'boolean'], + 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'type' => 'boolean'], + 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'backlog' => ['column' => 'backlog', 'label' => 'Backlog', 'type' => 'JSON_OBJECT'], + 'board' => ['column' => 'board', 'label' => 'Board', 'type' => 'JSON_OBJECT'], + 'flow' => ['column' => 'flow', 'label' => 'Flow', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'roadmap' => ['column' => 'roadmap', 'label' => 'Roadmap', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'string'], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'string'], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'string'], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'string'], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'string'], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'string'], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'string'], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'string'], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'string'], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'string'], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'string'], ]; } diff --git a/src/Http/Requests/Milestone/LockRequest.php b/src/Http/Requests/Milestone/LockRequest.php index 8bae359..4f32198 100644 --- a/src/Http/Requests/Milestone/LockRequest.php +++ b/src/Http/Requests/Milestone/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], 'release_id' => ['nullable', 'uuid'], @@ -34,22 +35,47 @@ class StoreRequest extends BaseStoreRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,45 +83,35 @@ class StoreRequest extends BaseStoreRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_milestones'; - /** * Prepare the data for validation. * @@ -107,38 +123,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Milestone/UnlockRequest.php b/src/Http/Requests/Milestone/UnlockRequest.php index d7b5e13..c47cedd 100644 --- a/src/Http/Requests/Milestone/UnlockRequest.php +++ b/src/Http/Requests/Milestone/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], 'release_id' => ['nullable', 'uuid'], @@ -34,22 +35,47 @@ class UpdateRequest extends BaseUpdateRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,45 +83,35 @@ class UpdateRequest extends BaseUpdateRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_milestones'; - /** * Prepare the data for validation. * @@ -107,38 +123,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Note/CreateRequest.php b/src/Http/Requests/Note/CreateRequest.php index 4238465..a842709 100644 --- a/src/Http/Requests/Note/CreateRequest.php +++ b/src/Http/Requests/Note/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'note_type' => ['nullable', 'string'], + 'matrix_id' => ['nullable', 'uuid'], + 'tag_id' => ['nullable', 'uuid'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], - 'retired' => ['boolean'], - 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; diff --git a/src/Http/Requests/Note/DestroyRequest.php b/src/Http/Requests/Note/DestroyRequest.php index 8ba7701..44fb75a 100644 --- a/src/Http/Requests/Note/DestroyRequest.php +++ b/src/Http/Requests/Note/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'note_type' => ['nullable', 'string'], + 'matrix_id' => ['nullable', 'uuid'], + 'tag_id' => ['nullable', 'uuid'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], - 'retired' => ['boolean'], - 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; diff --git a/src/Http/Requests/Note/IndexRequest.php b/src/Http/Requests/Note/IndexRequest.php index 694834a..fe3d559 100644 --- a/src/Http/Requests/Note/IndexRequest.php +++ b/src/Http/Requests/Note/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], - 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], - 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], - 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], - 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], - 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned End At', 'nullable' => true], - 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled At', 'nullable' => true], - 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed At', 'nullable' => true], - 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo At', 'nullable' => true], - 'fixed_at' => ['column' => 'fixed_at', 'label' => 'Fixed At', 'nullable' => true], - 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed At', 'nullable' => true], - 'published_at' => ['column' => 'published_at', 'label' => 'Published At', 'nullable' => true], - 'released_at' => ['column' => 'released_at', 'label' => 'Released At', 'nullable' => true], - 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed At', 'nullable' => true], - 'resolved_at' => ['column' => 'resolved_at', 'label' => 'Resolved At', 'nullable' => true], - 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended At', 'nullable' => true], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated at', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], - 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], - 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], 'internal' => ['column' => 'internal', 'label' => 'Internal', 'icon' => 'fa-solid fa-server'], 'locked' => ['column' => 'locked', 'label' => 'Locked', 'icon' => 'fa-solid fa-lock text-warning'], 'pending' => ['column' => 'pending', 'label' => 'Pending', 'icon' => 'fa-solid fa-circle-pause text-warning'], 'planned' => ['column' => 'planned', 'label' => 'Planned', 'icon' => 'fa-solid fa-circle-pause text-success'], 'problem' => ['column' => 'problem', 'label' => 'Problem', 'icon' => 'fa-solid fa-triangle-exclamation text-danger'], - 'published' => ['column' => 'published', 'label' => 'Published', 'icon' => 'fa-solid fa-book'], - 'released' => ['column' => 'released', 'label' => 'Released', 'icon' => 'fa-solid fa-dove'], - 'retired' => ['column' => 'retired', 'label' => 'Retired', 'icon' => 'fa-solid fa-chair text-success'], - 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], - 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'note_type' => ['column' => 'note_type', 'label' => 'Note Type', 'type' => 'string', 'nullable' => true], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'uuid', 'nullable' => true], + 'note_type' => ['column' => 'note_type', 'label' => 'Note type', 'type' => 'string', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'uuid', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'note_type' => ['column' => 'note_type', 'label' => 'Note type', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], + 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], + 'completed' => ['column' => 'completed', 'label' => 'Completed', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Note/LockRequest.php b/src/Http/Requests/Note/LockRequest.php index 7ca1e33..79fd73f 100644 --- a/src/Http/Requests/Note/LockRequest.php +++ b/src/Http/Requests/Note/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'note_type' => ['nullable', 'string'], + 'matrix_id' => ['nullable', 'uuid'], + 'tag_id' => ['nullable', 'uuid'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], - 'retired' => ['boolean'], - 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_notes'; - /** * Prepare the data for validation. * @@ -93,38 +86,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Note/UnlockRequest.php b/src/Http/Requests/Note/UnlockRequest.php index 0431f65..0c7c899 100644 --- a/src/Http/Requests/Note/UnlockRequest.php +++ b/src/Http/Requests/Note/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'note_type' => ['nullable', 'string'], + 'matrix_id' => ['nullable', 'uuid'], + 'tag_id' => ['nullable', 'uuid'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], - 'retired' => ['boolean'], - 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_notes'; - /** * Prepare the data for validation. * @@ -93,38 +86,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Project/CreateRequest.php b/src/Http/Requests/Project/CreateRequest.php index 8a514b1..bbba121 100644 --- a/src/Http/Requests/Project/CreateRequest.php +++ b/src/Http/Requests/Project/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'release_id' => ['nullable', 'uuid'], @@ -34,60 +35,75 @@ class CreateRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], + 'key' => ['nullable', 'string'], + 'code_name' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], + 'history' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Project/DestroyRequest.php b/src/Http/Requests/Project/DestroyRequest.php index 66fba18..85dfa0c 100644 --- a/src/Http/Requests/Project/DestroyRequest.php +++ b/src/Http/Requests/Project/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'release_id' => ['nullable', 'uuid'], @@ -34,60 +35,75 @@ class EditRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], + 'key' => ['nullable', 'string'], + 'code_name' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], + 'history' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Project/IndexRequest.php b/src/Http/Requests/Project/IndexRequest.php index 8f285da..64c5647 100644 --- a/src/Http/Requests/Project/IndexRequest.php +++ b/src/Http/Requests/Project/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], - 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated at', 'nullable' => true], 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], @@ -27,78 +27,175 @@ class IndexRequest extends BaseIndexRequest 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled At', 'nullable' => true], 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed At', 'nullable' => true], 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo At', 'nullable' => true], - 'fixed_at' => ['column' => 'fixed_at', 'label' => 'Fixed At', 'nullable' => true], 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed At', 'nullable' => true], 'published_at' => ['column' => 'published_at', 'label' => 'Published At', 'nullable' => true], 'released_at' => ['column' => 'released_at', 'label' => 'Released At', 'nullable' => true], 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed At', 'nullable' => true], - 'resolved_at' => ['column' => 'resolved_at', 'label' => 'Resolved At', 'nullable' => true], 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended At', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], - 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], - 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], 'internal' => ['column' => 'internal', 'label' => 'Internal', 'icon' => 'fa-solid fa-server'], 'locked' => ['column' => 'locked', 'label' => 'Locked', 'icon' => 'fa-solid fa-lock text-warning'], 'pending' => ['column' => 'pending', 'label' => 'Pending', 'icon' => 'fa-solid fa-circle-pause text-warning'], 'planned' => ['column' => 'planned', 'label' => 'Planned', 'icon' => 'fa-solid fa-circle-pause text-success'], 'problem' => ['column' => 'problem', 'label' => 'Problem', 'icon' => 'fa-solid fa-triangle-exclamation text-danger'], - 'published' => ['column' => 'published', 'label' => 'Published', 'icon' => 'fa-solid fa-book'], 'released' => ['column' => 'released', 'label' => 'Released', 'icon' => 'fa-solid fa-dove'], - 'retired' => ['column' => 'retired', 'label' => 'Retired', 'icon' => 'fa-solid fa-chair text-success'], - 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'project_type' => ['column' => 'project_type', 'label' => 'Project Type', 'type' => 'string', 'nullable' => true], - 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog Id', 'type' => 'uuid', 'nullable' => false], - 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'uuid', 'nullable' => false], - 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'uuid', 'nullable' => false], - 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => false], - 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'uuid', 'nullable' => false], - 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => false], - 'release_id' => ['column' => 'release_id', 'label' => 'Release Id', 'type' => 'uuid', 'nullable' => false], - 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap Id', 'type' => 'uuid', 'nullable' => false], - 'source_id' => ['column' => 'source_id', 'label' => 'Source Id', 'type' => 'uuid', 'nullable' => false], - 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint Id', 'type' => 'uuid', 'nullable' => false], - 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag Id', 'type' => 'uuid', 'nullable' => false], - 'team_id' => ['column' => 'team_id', 'label' => 'Team Id', 'type' => 'uuid', 'nullable' => false], - 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket Id', 'type' => 'uuid', 'nullable' => false], - 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'uuid', 'nullable' => true], + 'project_type' => ['column' => 'project_type', 'label' => 'Project type', 'type' => 'string', 'nullable' => true], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'uuid', 'nullable' => true], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'uuid', 'nullable' => true], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'uuid', 'nullable' => true], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'uuid', 'nullable' => true], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'uuid', 'nullable' => true], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'uuid', 'nullable' => true], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'uuid', 'nullable' => true], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'uuid', 'nullable' => true], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'uuid', 'nullable' => true], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'uuid', 'nullable' => true], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'uuid', 'nullable' => true], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'uuid', 'nullable' => true], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'uuid', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + 'key' => ['column' => 'key', 'label' => 'Key', 'type' => 'string', 'nullable' => true], + 'code_name' => ['column' => 'code_name', 'label' => 'Code name', 'type' => 'string', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'project_type' => ['column' => 'project_type', 'label' => 'Project type', 'type' => 'string'], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'string'], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'string'], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'string'], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'string'], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'string'], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'string'], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'string'], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'string'], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'string'], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'string'], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'string'], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'string'], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'start_at' => ['column' => 'start_at', 'label' => 'Start at', 'type' => 'string'], + 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned start at', 'type' => 'string'], + 'end_at' => ['column' => 'end_at', 'label' => 'End at', 'type' => 'string'], + 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned end at', 'type' => 'string'], + 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled at', 'type' => 'string'], + 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed at', 'type' => 'string'], + 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo at', 'type' => 'string'], + 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed at', 'type' => 'string'], + 'published_at' => ['column' => 'published_at', 'label' => 'Published at', 'type' => 'string'], + 'released_at' => ['column' => 'released_at', 'label' => 'Released at', 'type' => 'string'], + 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed at', 'type' => 'string'], + 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended at', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], + 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], + 'completed' => ['column' => 'completed', 'label' => 'Completed', 'type' => 'boolean'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], + 'released' => ['column' => 'released', 'label' => 'Released', 'type' => 'boolean'], + 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'key' => ['column' => 'key', 'label' => 'Key', 'type' => 'string'], + 'code_name' => ['column' => 'code_name', 'label' => 'Code name', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'backlog' => ['column' => 'backlog', 'label' => 'Backlog', 'type' => 'JSON_OBJECT'], + 'board' => ['column' => 'board', 'label' => 'Board', 'type' => 'JSON_OBJECT'], + 'flow' => ['column' => 'flow', 'label' => 'Flow', 'type' => 'JSON_OBJECT'], + 'history' => ['column' => 'history', 'label' => 'History', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'roadmap' => ['column' => 'roadmap', 'label' => 'Roadmap', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Project/LockRequest.php b/src/Http/Requests/Project/LockRequest.php index 9b55579..fffa782 100644 --- a/src/Http/Requests/Project/LockRequest.php +++ b/src/Http/Requests/Project/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'release_id' => ['nullable', 'uuid'], @@ -34,68 +35,81 @@ class StoreRequest extends BaseStoreRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], + 'key' => ['nullable', 'string'], + 'code_name' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], + 'history' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_projects'; - /** * Prepare the data for validation. * @@ -107,38 +121,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Project/UnlockRequest.php b/src/Http/Requests/Project/UnlockRequest.php index 249e18f..744475d 100644 --- a/src/Http/Requests/Project/UnlockRequest.php +++ b/src/Http/Requests/Project/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'release_id' => ['nullable', 'uuid'], @@ -34,68 +35,81 @@ class UpdateRequest extends BaseUpdateRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], + 'key' => ['nullable', 'string'], + 'code_name' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], + 'history' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_projects'; - /** * Prepare the data for validation. * @@ -107,38 +121,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Release/CreateRequest.php b/src/Http/Requests/Release/CreateRequest.php index 6a70f3d..1b108a6 100644 --- a/src/Http/Requests/Release/CreateRequest.php +++ b/src/Http/Requests/Release/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,22 +35,45 @@ class CreateRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,37 +81,27 @@ class CreateRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Release/DestroyRequest.php b/src/Http/Requests/Release/DestroyRequest.php index 0169fab..ea1e16e 100644 --- a/src/Http/Requests/Release/DestroyRequest.php +++ b/src/Http/Requests/Release/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,22 +35,45 @@ class EditRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,37 +81,27 @@ class EditRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Release/IndexRequest.php b/src/Http/Requests/Release/IndexRequest.php index bfbf169..6715eaa 100644 --- a/src/Http/Requests/Release/IndexRequest.php +++ b/src/Http/Requests/Release/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], - 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated at', 'nullable' => true], 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], @@ -27,25 +27,22 @@ class IndexRequest extends BaseIndexRequest 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled At', 'nullable' => true], 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed At', 'nullable' => true], 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo At', 'nullable' => true], - 'fixed_at' => ['column' => 'fixed_at', 'label' => 'Fixed At', 'nullable' => true], 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed At', 'nullable' => true], 'published_at' => ['column' => 'published_at', 'label' => 'Published At', 'nullable' => true], 'released_at' => ['column' => 'released_at', 'label' => 'Released At', 'nullable' => true], 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed At', 'nullable' => true], - 'resolved_at' => ['column' => 'resolved_at', 'label' => 'Resolved At', 'nullable' => true], 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended At', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], - 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], - 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], 'internal' => ['column' => 'internal', 'label' => 'Internal', 'icon' => 'fa-solid fa-server'], 'locked' => ['column' => 'locked', 'label' => 'Locked', 'icon' => 'fa-solid fa-lock text-warning'], @@ -54,51 +51,148 @@ class IndexRequest extends BaseIndexRequest 'problem' => ['column' => 'problem', 'label' => 'Problem', 'icon' => 'fa-solid fa-triangle-exclamation text-danger'], 'published' => ['column' => 'published', 'label' => 'Published', 'icon' => 'fa-solid fa-book'], 'released' => ['column' => 'released', 'label' => 'Released', 'icon' => 'fa-solid fa-dove'], - 'retired' => ['column' => 'retired', 'label' => 'Retired', 'icon' => 'fa-solid fa-chair text-success'], - 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'release_type' => ['column' => 'release_type', 'label' => 'Release Type', 'type' => 'string', 'nullable' => true], - 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog Id', 'type' => 'uuid', 'nullable' => false], - 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'uuid', 'nullable' => false], - 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'uuid', 'nullable' => false], - 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => false], - 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'uuid', 'nullable' => false], - 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => false], - 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'uuid', 'nullable' => false], - 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap Id', 'type' => 'uuid', 'nullable' => false], - 'source_id' => ['column' => 'source_id', 'label' => 'Source Id', 'type' => 'uuid', 'nullable' => false], - 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint Id', 'type' => 'uuid', 'nullable' => false], - 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag Id', 'type' => 'uuid', 'nullable' => false], - 'team_id' => ['column' => 'team_id', 'label' => 'Team Id', 'type' => 'uuid', 'nullable' => false], - 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket Id', 'type' => 'uuid', 'nullable' => false], - 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'uuid', 'nullable' => true], + 'release_type' => ['column' => 'release_type', 'label' => 'Release type', 'type' => 'string', 'nullable' => true], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'uuid', 'nullable' => true], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'uuid', 'nullable' => true], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'uuid', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'uuid', 'nullable' => true], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'uuid', 'nullable' => true], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'uuid', 'nullable' => true], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'uuid', 'nullable' => true], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'uuid', 'nullable' => true], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'uuid', 'nullable' => true], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'uuid', 'nullable' => true], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'uuid', 'nullable' => true], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'uuid', 'nullable' => true], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'uuid', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'release_type' => ['column' => 'release_type', 'label' => 'Release type', 'type' => 'string'], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'string'], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'string'], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'string'], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'string'], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'string'], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'string'], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'string'], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'string'], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'string'], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'string'], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'string'], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'string'], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'start_at' => ['column' => 'start_at', 'label' => 'Start at', 'type' => 'string'], + 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned start at', 'type' => 'string'], + 'end_at' => ['column' => 'end_at', 'label' => 'End at', 'type' => 'string'], + 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned end at', 'type' => 'string'], + 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled at', 'type' => 'string'], + 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed at', 'type' => 'string'], + 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo at', 'type' => 'string'], + 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed at', 'type' => 'string'], + 'published_at' => ['column' => 'published_at', 'label' => 'Published at', 'type' => 'string'], + 'released_at' => ['column' => 'released_at', 'label' => 'Released at', 'type' => 'string'], + 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed at', 'type' => 'string'], + 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended at', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], + 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], + 'completed' => ['column' => 'completed', 'label' => 'Completed', 'type' => 'boolean'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], + 'published' => ['column' => 'published', 'label' => 'Published', 'type' => 'boolean'], + 'released' => ['column' => 'released', 'label' => 'Released', 'type' => 'boolean'], + 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'backlog' => ['column' => 'backlog', 'label' => 'Backlog', 'type' => 'JSON_OBJECT'], + 'board' => ['column' => 'board', 'label' => 'Board', 'type' => 'JSON_OBJECT'], + 'flow' => ['column' => 'flow', 'label' => 'Flow', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'roadmap' => ['column' => 'roadmap', 'label' => 'Roadmap', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Release/LockRequest.php b/src/Http/Requests/Release/LockRequest.php index bd7019f..1c7bc88 100644 --- a/src/Http/Requests/Release/LockRequest.php +++ b/src/Http/Requests/Release/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,22 +35,45 @@ class StoreRequest extends BaseStoreRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,45 +81,33 @@ class StoreRequest extends BaseStoreRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_releases'; - /** * Prepare the data for validation. * @@ -107,38 +119,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Release/UnlockRequest.php b/src/Http/Requests/Release/UnlockRequest.php index 4e6ac1f..b85b187 100644 --- a/src/Http/Requests/Release/UnlockRequest.php +++ b/src/Http/Requests/Release/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,22 +35,45 @@ class UpdateRequest extends BaseUpdateRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,45 +81,33 @@ class UpdateRequest extends BaseUpdateRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_releases'; - /** * Prepare the data for validation. * @@ -107,38 +119,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Roadmap/CreateRequest.php b/src/Http/Requests/Roadmap/CreateRequest.php index 0fc8b6c..082179d 100644 --- a/src/Http/Requests/Roadmap/CreateRequest.php +++ b/src/Http/Requests/Roadmap/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,22 +35,45 @@ class CreateRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,37 +81,27 @@ class CreateRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Roadmap/DestroyRequest.php b/src/Http/Requests/Roadmap/DestroyRequest.php index 3dbbd57..2dccbbd 100644 --- a/src/Http/Requests/Roadmap/DestroyRequest.php +++ b/src/Http/Requests/Roadmap/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,22 +35,45 @@ class EditRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,37 +81,27 @@ class EditRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Roadmap/IndexRequest.php b/src/Http/Requests/Roadmap/IndexRequest.php index 92d91fc..e85abfb 100644 --- a/src/Http/Requests/Roadmap/IndexRequest.php +++ b/src/Http/Requests/Roadmap/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], - 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated at', 'nullable' => true], 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], @@ -27,25 +27,22 @@ class IndexRequest extends BaseIndexRequest 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled At', 'nullable' => true], 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed At', 'nullable' => true], 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo At', 'nullable' => true], - 'fixed_at' => ['column' => 'fixed_at', 'label' => 'Fixed At', 'nullable' => true], 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed At', 'nullable' => true], 'published_at' => ['column' => 'published_at', 'label' => 'Published At', 'nullable' => true], 'released_at' => ['column' => 'released_at', 'label' => 'Released At', 'nullable' => true], 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed At', 'nullable' => true], - 'resolved_at' => ['column' => 'resolved_at', 'label' => 'Resolved At', 'nullable' => true], 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended At', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], - 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], - 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], 'internal' => ['column' => 'internal', 'label' => 'Internal', 'icon' => 'fa-solid fa-server'], 'locked' => ['column' => 'locked', 'label' => 'Locked', 'icon' => 'fa-solid fa-lock text-warning'], @@ -54,51 +51,148 @@ class IndexRequest extends BaseIndexRequest 'problem' => ['column' => 'problem', 'label' => 'Problem', 'icon' => 'fa-solid fa-triangle-exclamation text-danger'], 'published' => ['column' => 'published', 'label' => 'Published', 'icon' => 'fa-solid fa-book'], 'released' => ['column' => 'released', 'label' => 'Released', 'icon' => 'fa-solid fa-dove'], - 'retired' => ['column' => 'retired', 'label' => 'Retired', 'icon' => 'fa-solid fa-chair text-success'], - 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'roadmap_type' => ['column' => 'roadmap_type', 'label' => 'Roadmap Type', 'type' => 'string', 'nullable' => true], - 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog Id', 'type' => 'uuid', 'nullable' => false], - 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'uuid', 'nullable' => false], - 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'uuid', 'nullable' => false], - 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => false], - 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'uuid', 'nullable' => false], - 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => false], - 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'uuid', 'nullable' => false], - 'release_id' => ['column' => 'release_id', 'label' => 'Release Id', 'type' => 'uuid', 'nullable' => false], - 'source_id' => ['column' => 'source_id', 'label' => 'Source Id', 'type' => 'uuid', 'nullable' => false], - 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint Id', 'type' => 'uuid', 'nullable' => false], - 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag Id', 'type' => 'uuid', 'nullable' => false], - 'team_id' => ['column' => 'team_id', 'label' => 'Team Id', 'type' => 'uuid', 'nullable' => false], - 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket Id', 'type' => 'uuid', 'nullable' => false], - 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'uuid', 'nullable' => true], + 'roadmap_type' => ['column' => 'roadmap_type', 'label' => 'Roadmap type', 'type' => 'string', 'nullable' => true], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'uuid', 'nullable' => true], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'uuid', 'nullable' => true], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'uuid', 'nullable' => true], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'uuid', 'nullable' => true], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'uuid', 'nullable' => true], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'uuid', 'nullable' => true], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'uuid', 'nullable' => true], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'uuid', 'nullable' => true], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'uuid', 'nullable' => true], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'uuid', 'nullable' => true], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'uuid', 'nullable' => true], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'uuid', 'nullable' => true], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'uuid', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'roadmap_type' => ['column' => 'roadmap_type', 'label' => 'Roadmap type', 'type' => 'string'], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'string'], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'string'], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'string'], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'string'], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'string'], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'string'], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'string'], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'string'], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'string'], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'string'], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'string'], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'string'], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'start_at' => ['column' => 'start_at', 'label' => 'Start at', 'type' => 'string'], + 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned start at', 'type' => 'string'], + 'end_at' => ['column' => 'end_at', 'label' => 'End at', 'type' => 'string'], + 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned end at', 'type' => 'string'], + 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled at', 'type' => 'string'], + 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed at', 'type' => 'string'], + 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo at', 'type' => 'string'], + 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed at', 'type' => 'string'], + 'published_at' => ['column' => 'published_at', 'label' => 'Published at', 'type' => 'string'], + 'released_at' => ['column' => 'released_at', 'label' => 'Released at', 'type' => 'string'], + 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed at', 'type' => 'string'], + 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended at', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], + 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], + 'completed' => ['column' => 'completed', 'label' => 'Completed', 'type' => 'boolean'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], + 'published' => ['column' => 'published', 'label' => 'Published', 'type' => 'boolean'], + 'released' => ['column' => 'released', 'label' => 'Released', 'type' => 'boolean'], + 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'backlog' => ['column' => 'backlog', 'label' => 'Backlog', 'type' => 'JSON_OBJECT'], + 'board' => ['column' => 'board', 'label' => 'Board', 'type' => 'JSON_OBJECT'], + 'flow' => ['column' => 'flow', 'label' => 'Flow', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'roadmap' => ['column' => 'roadmap', 'label' => 'Roadmap', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Roadmap/LockRequest.php b/src/Http/Requests/Roadmap/LockRequest.php index 4583c65..8366e67 100644 --- a/src/Http/Requests/Roadmap/LockRequest.php +++ b/src/Http/Requests/Roadmap/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,22 +35,45 @@ class StoreRequest extends BaseStoreRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,45 +81,33 @@ class StoreRequest extends BaseStoreRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_roadmaps'; - /** * Prepare the data for validation. * @@ -107,38 +119,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Roadmap/UnlockRequest.php b/src/Http/Requests/Roadmap/UnlockRequest.php index d580168..9b037f5 100644 --- a/src/Http/Requests/Roadmap/UnlockRequest.php +++ b/src/Http/Requests/Roadmap/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,22 +35,45 @@ class UpdateRequest extends BaseUpdateRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,45 +81,33 @@ class UpdateRequest extends BaseUpdateRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_roadmaps'; - /** * Prepare the data for validation. * @@ -107,38 +119,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Source/CreateRequest.php b/src/Http/Requests/Source/CreateRequest.php index b9d542b..9ea5ef5 100644 --- a/src/Http/Requests/Source/CreateRequest.php +++ b/src/Http/Requests/Source/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'source_type' => ['nullable', 'string'], - 'backlog_id' => ['nullable', 'uuid'], - 'board_id' => ['nullable', 'uuid'], - 'epic_id' => ['nullable', 'uuid'], - 'flow_id' => ['nullable', 'uuid'], - 'milestone_id' => ['nullable', 'uuid'], - 'note_id' => ['nullable', 'uuid'], - 'project_id' => ['nullable', 'uuid'], - 'release_id' => ['nullable', 'uuid'], - 'roadmap_id' => ['nullable', 'uuid'], - 'sprint_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'tag_id' => ['nullable', 'uuid'], 'team_id' => ['nullable', 'uuid'], - 'ticket_id' => ['nullable', 'uuid'], - 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,39 +69,25 @@ class CreateRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; diff --git a/src/Http/Requests/Source/DestroyRequest.php b/src/Http/Requests/Source/DestroyRequest.php index b068d11..96d58bd 100644 --- a/src/Http/Requests/Source/DestroyRequest.php +++ b/src/Http/Requests/Source/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'source_type' => ['nullable', 'string'], - 'backlog_id' => ['nullable', 'uuid'], - 'board_id' => ['nullable', 'uuid'], - 'epic_id' => ['nullable', 'uuid'], - 'flow_id' => ['nullable', 'uuid'], - 'milestone_id' => ['nullable', 'uuid'], - 'note_id' => ['nullable', 'uuid'], - 'project_id' => ['nullable', 'uuid'], - 'release_id' => ['nullable', 'uuid'], - 'roadmap_id' => ['nullable', 'uuid'], - 'sprint_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'tag_id' => ['nullable', 'uuid'], 'team_id' => ['nullable', 'uuid'], - 'ticket_id' => ['nullable', 'uuid'], - 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,39 +69,25 @@ class EditRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; diff --git a/src/Http/Requests/Source/IndexRequest.php b/src/Http/Requests/Source/IndexRequest.php index 9519a18..b5d33ac 100644 --- a/src/Http/Requests/Source/IndexRequest.php +++ b/src/Http/Requests/Source/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], - 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated at', 'nullable' => true], 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], @@ -27,25 +27,22 @@ class IndexRequest extends BaseIndexRequest 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled At', 'nullable' => true], 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed At', 'nullable' => true], 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo At', 'nullable' => true], - 'fixed_at' => ['column' => 'fixed_at', 'label' => 'Fixed At', 'nullable' => true], 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed At', 'nullable' => true], 'published_at' => ['column' => 'published_at', 'label' => 'Published At', 'nullable' => true], 'released_at' => ['column' => 'released_at', 'label' => 'Released At', 'nullable' => true], 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed At', 'nullable' => true], - 'resolved_at' => ['column' => 'resolved_at', 'label' => 'Resolved At', 'nullable' => true], 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended At', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], - 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], - 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], 'internal' => ['column' => 'internal', 'label' => 'Internal', 'icon' => 'fa-solid fa-server'], 'locked' => ['column' => 'locked', 'label' => 'Locked', 'icon' => 'fa-solid fa-lock text-warning'], @@ -54,51 +51,120 @@ class IndexRequest extends BaseIndexRequest 'problem' => ['column' => 'problem', 'label' => 'Problem', 'icon' => 'fa-solid fa-triangle-exclamation text-danger'], 'published' => ['column' => 'published', 'label' => 'Published', 'icon' => 'fa-solid fa-book'], 'released' => ['column' => 'released', 'label' => 'Released', 'icon' => 'fa-solid fa-dove'], - 'retired' => ['column' => 'retired', 'label' => 'Retired', 'icon' => 'fa-solid fa-chair text-success'], - 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'source_type' => ['column' => 'source_type', 'label' => 'Source Type', 'type' => 'string', 'nullable' => true], - 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog Id', 'type' => 'uuid', 'nullable' => false], - 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'uuid', 'nullable' => false], - 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'uuid', 'nullable' => false], - 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => false], - 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'uuid', 'nullable' => false], - 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => false], - 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'uuid', 'nullable' => false], - 'release_id' => ['column' => 'release_id', 'label' => 'Release Id', 'type' => 'uuid', 'nullable' => false], - 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap Id', 'type' => 'uuid', 'nullable' => false], - 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint Id', 'type' => 'uuid', 'nullable' => false], - 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag Id', 'type' => 'uuid', 'nullable' => false], - 'team_id' => ['column' => 'team_id', 'label' => 'Team Id', 'type' => 'uuid', 'nullable' => false], - 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket Id', 'type' => 'uuid', 'nullable' => false], - 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'uuid', 'nullable' => true], + 'source_type' => ['column' => 'source_type', 'label' => 'Source type', 'type' => 'string', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'uuid', 'nullable' => true], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'uuid', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'source_type' => ['column' => 'source_type', 'label' => 'Source type', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'string'], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'start_at' => ['column' => 'start_at', 'label' => 'Start at', 'type' => 'string'], + 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned start at', 'type' => 'string'], + 'end_at' => ['column' => 'end_at', 'label' => 'End at', 'type' => 'string'], + 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned end at', 'type' => 'string'], + 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled at', 'type' => 'string'], + 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed at', 'type' => 'string'], + 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo at', 'type' => 'string'], + 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed at', 'type' => 'string'], + 'published_at' => ['column' => 'published_at', 'label' => 'Published at', 'type' => 'string'], + 'released_at' => ['column' => 'released_at', 'label' => 'Released at', 'type' => 'string'], + 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed at', 'type' => 'string'], + 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended at', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], + 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], + 'completed' => ['column' => 'completed', 'label' => 'Completed', 'type' => 'boolean'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], + 'published' => ['column' => 'published', 'label' => 'Published', 'type' => 'boolean'], + 'released' => ['column' => 'released', 'label' => 'Released', 'type' => 'boolean'], + 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Source/LockRequest.php b/src/Http/Requests/Source/LockRequest.php index 66c7c13..76719aa 100644 --- a/src/Http/Requests/Source/LockRequest.php +++ b/src/Http/Requests/Source/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'source_type' => ['nullable', 'string'], - 'backlog_id' => ['nullable', 'uuid'], - 'board_id' => ['nullable', 'uuid'], - 'epic_id' => ['nullable', 'uuid'], - 'flow_id' => ['nullable', 'uuid'], - 'milestone_id' => ['nullable', 'uuid'], - 'note_id' => ['nullable', 'uuid'], - 'project_id' => ['nullable', 'uuid'], - 'release_id' => ['nullable', 'uuid'], - 'roadmap_id' => ['nullable', 'uuid'], - 'sprint_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'tag_id' => ['nullable', 'uuid'], 'team_id' => ['nullable', 'uuid'], - 'ticket_id' => ['nullable', 'uuid'], - 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,45 +69,29 @@ class StoreRequest extends BaseStoreRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_sources'; - /** * Prepare the data for validation. * @@ -107,38 +103,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Source/UnlockRequest.php b/src/Http/Requests/Source/UnlockRequest.php index 05e17e0..74b01ea 100644 --- a/src/Http/Requests/Source/UnlockRequest.php +++ b/src/Http/Requests/Source/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'source_type' => ['nullable', 'string'], - 'backlog_id' => ['nullable', 'uuid'], - 'board_id' => ['nullable', 'uuid'], - 'epic_id' => ['nullable', 'uuid'], - 'flow_id' => ['nullable', 'uuid'], - 'milestone_id' => ['nullable', 'uuid'], - 'note_id' => ['nullable', 'uuid'], - 'project_id' => ['nullable', 'uuid'], - 'release_id' => ['nullable', 'uuid'], - 'roadmap_id' => ['nullable', 'uuid'], - 'sprint_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'tag_id' => ['nullable', 'uuid'], 'team_id' => ['nullable', 'uuid'], - 'ticket_id' => ['nullable', 'uuid'], - 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,45 +69,29 @@ class UpdateRequest extends BaseUpdateRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], - 'retired' => ['boolean'], + 'released' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_sources'; - /** * Prepare the data for validation. * @@ -107,38 +103,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Sprint/CreateRequest.php b/src/Http/Requests/Sprint/CreateRequest.php index b6f492d..6ff0432 100644 --- a/src/Http/Requests/Sprint/CreateRequest.php +++ b/src/Http/Requests/Sprint/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,22 +35,49 @@ class CreateRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'fixed_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'resolved_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,37 +85,29 @@ class CreateRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Sprint/DestroyRequest.php b/src/Http/Requests/Sprint/DestroyRequest.php index 85be2b8..0d9f1fa 100644 --- a/src/Http/Requests/Sprint/DestroyRequest.php +++ b/src/Http/Requests/Sprint/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,22 +35,49 @@ class EditRequest extends FormRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'fixed_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'resolved_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,37 +85,29 @@ class EditRequest extends FormRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Sprint/IndexRequest.php b/src/Http/Requests/Sprint/IndexRequest.php index c121071..4513169 100644 --- a/src/Http/Requests/Sprint/IndexRequest.php +++ b/src/Http/Requests/Sprint/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], - 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated at', 'nullable' => true], 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], @@ -37,13 +37,14 @@ class IndexRequest extends BaseIndexRequest ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], @@ -58,47 +59,152 @@ class IndexRequest extends BaseIndexRequest 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'sprint_type' => ['column' => 'sprint_type', 'label' => 'Sprint Type', 'type' => 'string', 'nullable' => true], - 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog Id', 'type' => 'uuid', 'nullable' => false], - 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'uuid', 'nullable' => false], - 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'uuid', 'nullable' => false], - 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => false], - 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'uuid', 'nullable' => false], - 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => false], - 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'uuid', 'nullable' => false], - 'release_id' => ['column' => 'release_id', 'label' => 'Release Id', 'type' => 'uuid', 'nullable' => false], - 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap Id', 'type' => 'uuid', 'nullable' => false], - 'source_id' => ['column' => 'source_id', 'label' => 'Source Id', 'type' => 'uuid', 'nullable' => false], - 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag Id', 'type' => 'uuid', 'nullable' => false], - 'team_id' => ['column' => 'team_id', 'label' => 'Team Id', 'type' => 'uuid', 'nullable' => false], - 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket Id', 'type' => 'uuid', 'nullable' => false], - 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'uuid', 'nullable' => true], + 'sprint_type' => ['column' => 'sprint_type', 'label' => 'Sprint type', 'type' => 'string', 'nullable' => true], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'uuid', 'nullable' => true], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'uuid', 'nullable' => true], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'uuid', 'nullable' => true], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'uuid', 'nullable' => true], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'uuid', 'nullable' => true], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'uuid', 'nullable' => true], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'uuid', 'nullable' => true], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'uuid', 'nullable' => true], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'uuid', 'nullable' => true], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'uuid', 'nullable' => true], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'uuid', 'nullable' => true], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'uuid', 'nullable' => true], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'uuid', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'sprint_type' => ['column' => 'sprint_type', 'label' => 'Sprint type', 'type' => 'string'], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'string'], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'string'], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'string'], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'string'], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'string'], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'string'], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'string'], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'string'], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'string'], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'string'], + 'team_id' => ['column' => 'team_id', 'label' => 'Team id', 'type' => 'string'], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'string'], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'start_at' => ['column' => 'start_at', 'label' => 'Start at', 'type' => 'string'], + 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned start at', 'type' => 'string'], + 'end_at' => ['column' => 'end_at', 'label' => 'End at', 'type' => 'string'], + 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned end at', 'type' => 'string'], + 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled at', 'type' => 'string'], + 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed at', 'type' => 'string'], + 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo at', 'type' => 'string'], + 'fixed_at' => ['column' => 'fixed_at', 'label' => 'Fixed at', 'type' => 'string'], + 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed at', 'type' => 'string'], + 'published_at' => ['column' => 'published_at', 'label' => 'Published at', 'type' => 'string'], + 'released_at' => ['column' => 'released_at', 'label' => 'Released at', 'type' => 'string'], + 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed at', 'type' => 'string'], + 'resolved_at' => ['column' => 'resolved_at', 'label' => 'Resolved at', 'type' => 'string'], + 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended at', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], + 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], + 'completed' => ['column' => 'completed', 'label' => 'Completed', 'type' => 'boolean'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], + 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'type' => 'boolean'], + 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], + 'published' => ['column' => 'published', 'label' => 'Published', 'type' => 'boolean'], + 'released' => ['column' => 'released', 'label' => 'Released', 'type' => 'boolean'], + 'retired' => ['column' => 'retired', 'label' => 'Retired', 'type' => 'boolean'], + 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'type' => 'boolean'], + 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'backlog' => ['column' => 'backlog', 'label' => 'Backlog', 'type' => 'JSON_OBJECT'], + 'board' => ['column' => 'board', 'label' => 'Board', 'type' => 'JSON_OBJECT'], + 'flow' => ['column' => 'flow', 'label' => 'Flow', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'roadmap' => ['column' => 'roadmap', 'label' => 'Roadmap', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Sprint/LockRequest.php b/src/Http/Requests/Sprint/LockRequest.php index 682ec08..0d0858b 100644 --- a/src/Http/Requests/Sprint/LockRequest.php +++ b/src/Http/Requests/Sprint/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,22 +35,49 @@ class StoreRequest extends BaseStoreRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'fixed_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'resolved_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,45 +85,35 @@ class StoreRequest extends BaseStoreRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_sprints'; - /** * Prepare the data for validation. * @@ -107,38 +125,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Sprint/UnlockRequest.php b/src/Http/Requests/Sprint/UnlockRequest.php index 5f4ae20..f104d24 100644 --- a/src/Http/Requests/Sprint/UnlockRequest.php +++ b/src/Http/Requests/Sprint/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,22 +35,49 @@ class UpdateRequest extends BaseUpdateRequest 'team_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'fixed_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'published_at' => ['nullable', 'string'], + 'released_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'resolved_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], + 'duplicate' => ['boolean'], + 'fixed' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], @@ -57,45 +85,35 @@ class UpdateRequest extends BaseUpdateRequest 'planned' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], + 'released' => ['boolean'], 'retired' => ['boolean'], + 'resolved' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_sprints'; - /** * Prepare the data for validation. * @@ -107,38 +125,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Tag/CreateRequest.php b/src/Http/Requests/Tag/CreateRequest.php index 57f1b76..eeec749 100644 --- a/src/Http/Requests/Tag/CreateRequest.php +++ b/src/Http/Requests/Tag/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'tag_type' => ['nullable', 'string'], - 'backlog_id' => ['nullable', 'uuid'], - 'board_id' => ['nullable', 'uuid'], - 'epic_id' => ['nullable', 'uuid'], - 'flow_id' => ['nullable', 'uuid'], - 'milestone_id' => ['nullable', 'uuid'], - 'note_id' => ['nullable', 'uuid'], - 'project_id' => ['nullable', 'uuid'], - 'release_id' => ['nullable', 'uuid'], - 'roadmap_id' => ['nullable', 'uuid'], - 'source_id' => ['nullable', 'uuid'], - 'sprint_id' => ['nullable', 'uuid'], - 'team_id' => ['nullable', 'uuid'], - 'ticket_id' => ['nullable', 'uuid'], - 'version_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], - 'pending' => ['boolean'], - 'planned' => ['boolean'], - 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], - 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; diff --git a/src/Http/Requests/Tag/DestroyRequest.php b/src/Http/Requests/Tag/DestroyRequest.php index 85af8d3..d7c94a2 100644 --- a/src/Http/Requests/Tag/DestroyRequest.php +++ b/src/Http/Requests/Tag/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'tag_type' => ['nullable', 'string'], - 'backlog_id' => ['nullable', 'uuid'], - 'board_id' => ['nullable', 'uuid'], - 'epic_id' => ['nullable', 'uuid'], - 'flow_id' => ['nullable', 'uuid'], - 'milestone_id' => ['nullable', 'uuid'], - 'note_id' => ['nullable', 'uuid'], - 'project_id' => ['nullable', 'uuid'], - 'release_id' => ['nullable', 'uuid'], - 'roadmap_id' => ['nullable', 'uuid'], - 'source_id' => ['nullable', 'uuid'], - 'sprint_id' => ['nullable', 'uuid'], - 'team_id' => ['nullable', 'uuid'], - 'ticket_id' => ['nullable', 'uuid'], - 'version_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], - 'pending' => ['boolean'], - 'planned' => ['boolean'], - 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], - 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; diff --git a/src/Http/Requests/Tag/IndexRequest.php b/src/Http/Requests/Tag/IndexRequest.php index a105131..d7580bb 100644 --- a/src/Http/Requests/Tag/IndexRequest.php +++ b/src/Http/Requests/Tag/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], - 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], - 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], - 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], - 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], - 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned End At', 'nullable' => true], - 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled At', 'nullable' => true], - 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed At', 'nullable' => true], - 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo At', 'nullable' => true], - 'fixed_at' => ['column' => 'fixed_at', 'label' => 'Fixed At', 'nullable' => true], - 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed At', 'nullable' => true], - 'published_at' => ['column' => 'published_at', 'label' => 'Published At', 'nullable' => true], - 'released_at' => ['column' => 'released_at', 'label' => 'Released At', 'nullable' => true], - 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed At', 'nullable' => true], - 'resolved_at' => ['column' => 'resolved_at', 'label' => 'Resolved At', 'nullable' => true], - 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended At', 'nullable' => true], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated at', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], - 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], - 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], - 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], - 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], - 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], 'internal' => ['column' => 'internal', 'label' => 'Internal', 'icon' => 'fa-solid fa-server'], 'locked' => ['column' => 'locked', 'label' => 'Locked', 'icon' => 'fa-solid fa-lock text-warning'], - 'pending' => ['column' => 'pending', 'label' => 'Pending', 'icon' => 'fa-solid fa-circle-pause text-warning'], - 'planned' => ['column' => 'planned', 'label' => 'Planned', 'icon' => 'fa-solid fa-circle-pause text-success'], - 'problem' => ['column' => 'problem', 'label' => 'Problem', 'icon' => 'fa-solid fa-triangle-exclamation text-danger'], - 'published' => ['column' => 'published', 'label' => 'Published', 'icon' => 'fa-solid fa-book'], - 'released' => ['column' => 'released', 'label' => 'Released', 'icon' => 'fa-solid fa-dove'], 'retired' => ['column' => 'retired', 'label' => 'Retired', 'icon' => 'fa-solid fa-chair text-success'], - 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], - 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'tag_type' => ['column' => 'tag_type', 'label' => 'Tag Type', 'type' => 'string', 'nullable' => true], - 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog Id', 'type' => 'uuid', 'nullable' => false], - 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'uuid', 'nullable' => false], - 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'uuid', 'nullable' => false], - 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => false], - 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'uuid', 'nullable' => false], - 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => false], - 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'uuid', 'nullable' => false], - 'release_id' => ['column' => 'release_id', 'label' => 'Release Id', 'type' => 'uuid', 'nullable' => false], - 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap Id', 'type' => 'uuid', 'nullable' => false], - 'source_id' => ['column' => 'source_id', 'label' => 'Source Id', 'type' => 'uuid', 'nullable' => false], - 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint Id', 'type' => 'uuid', 'nullable' => false], - 'team_id' => ['column' => 'team_id', 'label' => 'Team Id', 'type' => 'uuid', 'nullable' => false], - 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket Id', 'type' => 'uuid', 'nullable' => false], - 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'tag_type' => ['column' => 'tag_type', 'label' => 'Tag type', 'type' => 'string', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'tag_type' => ['column' => 'tag_type', 'label' => 'Tag type', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'retired' => ['column' => 'retired', 'label' => 'Retired', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Tag/LockRequest.php b/src/Http/Requests/Tag/LockRequest.php index 9cbcae2..2a2785e 100644 --- a/src/Http/Requests/Tag/LockRequest.php +++ b/src/Http/Requests/Tag/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'tag_type' => ['nullable', 'string'], - 'backlog_id' => ['nullable', 'uuid'], - 'board_id' => ['nullable', 'uuid'], - 'epic_id' => ['nullable', 'uuid'], - 'flow_id' => ['nullable', 'uuid'], - 'milestone_id' => ['nullable', 'uuid'], - 'note_id' => ['nullable', 'uuid'], - 'project_id' => ['nullable', 'uuid'], - 'release_id' => ['nullable', 'uuid'], - 'roadmap_id' => ['nullable', 'uuid'], - 'source_id' => ['nullable', 'uuid'], - 'sprint_id' => ['nullable', 'uuid'], - 'team_id' => ['nullable', 'uuid'], - 'ticket_id' => ['nullable', 'uuid'], - 'version_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], - 'pending' => ['boolean'], - 'planned' => ['boolean'], - 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], - 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_tags'; - /** * Prepare the data for validation. * @@ -107,38 +80,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Tag/UnlockRequest.php b/src/Http/Requests/Tag/UnlockRequest.php index 388074f..16f9e9b 100644 --- a/src/Http/Requests/Tag/UnlockRequest.php +++ b/src/Http/Requests/Tag/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'tag_type' => ['nullable', 'string'], - 'backlog_id' => ['nullable', 'uuid'], - 'board_id' => ['nullable', 'uuid'], - 'epic_id' => ['nullable', 'uuid'], - 'flow_id' => ['nullable', 'uuid'], - 'milestone_id' => ['nullable', 'uuid'], - 'note_id' => ['nullable', 'uuid'], - 'project_id' => ['nullable', 'uuid'], - 'release_id' => ['nullable', 'uuid'], - 'roadmap_id' => ['nullable', 'uuid'], - 'source_id' => ['nullable', 'uuid'], - 'sprint_id' => ['nullable', 'uuid'], - 'team_id' => ['nullable', 'uuid'], - 'ticket_id' => ['nullable', 'uuid'], - 'version_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], - 'pending' => ['boolean'], - 'planned' => ['boolean'], - 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], - 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_tags'; - /** * Prepare the data for validation. * @@ -107,38 +80,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Team/CreateRequest.php b/src/Http/Requests/Team/CreateRequest.php index 9b23244..ea8f983 100644 --- a/src/Http/Requests/Team/CreateRequest.php +++ b/src/Http/Requests/Team/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,60 +35,70 @@ class CreateRequest extends FormRequest 'tag_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Team/DestroyRequest.php b/src/Http/Requests/Team/DestroyRequest.php index a5e841e..ccb034d 100644 --- a/src/Http/Requests/Team/DestroyRequest.php +++ b/src/Http/Requests/Team/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,60 +35,70 @@ class EditRequest extends FormRequest 'tag_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], diff --git a/src/Http/Requests/Team/IndexRequest.php b/src/Http/Requests/Team/IndexRequest.php index 17b69d6..dd5e3b4 100644 --- a/src/Http/Requests/Team/IndexRequest.php +++ b/src/Http/Requests/Team/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], - 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated at', 'nullable' => true], 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], @@ -27,78 +27,166 @@ class IndexRequest extends BaseIndexRequest 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled At', 'nullable' => true], 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed At', 'nullable' => true], 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo At', 'nullable' => true], - 'fixed_at' => ['column' => 'fixed_at', 'label' => 'Fixed At', 'nullable' => true], 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed At', 'nullable' => true], - 'published_at' => ['column' => 'published_at', 'label' => 'Published At', 'nullable' => true], - 'released_at' => ['column' => 'released_at', 'label' => 'Released At', 'nullable' => true], 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed At', 'nullable' => true], - 'resolved_at' => ['column' => 'resolved_at', 'label' => 'Resolved At', 'nullable' => true], 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended At', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], - 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], - 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], 'internal' => ['column' => 'internal', 'label' => 'Internal', 'icon' => 'fa-solid fa-server'], 'locked' => ['column' => 'locked', 'label' => 'Locked', 'icon' => 'fa-solid fa-lock text-warning'], 'pending' => ['column' => 'pending', 'label' => 'Pending', 'icon' => 'fa-solid fa-circle-pause text-warning'], 'planned' => ['column' => 'planned', 'label' => 'Planned', 'icon' => 'fa-solid fa-circle-pause text-success'], 'problem' => ['column' => 'problem', 'label' => 'Problem', 'icon' => 'fa-solid fa-triangle-exclamation text-danger'], - 'published' => ['column' => 'published', 'label' => 'Published', 'icon' => 'fa-solid fa-book'], - 'released' => ['column' => 'released', 'label' => 'Released', 'icon' => 'fa-solid fa-dove'], 'retired' => ['column' => 'retired', 'label' => 'Retired', 'icon' => 'fa-solid fa-chair text-success'], - 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'team_type' => ['column' => 'team_type', 'label' => 'Team Type', 'type' => 'string', 'nullable' => true], - 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog Id', 'type' => 'uuid', 'nullable' => false], - 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'uuid', 'nullable' => false], - 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'uuid', 'nullable' => false], - 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => false], - 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'uuid', 'nullable' => false], - 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => false], - 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'uuid', 'nullable' => false], - 'release_id' => ['column' => 'release_id', 'label' => 'Release Id', 'type' => 'uuid', 'nullable' => false], - 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap Id', 'type' => 'uuid', 'nullable' => false], - 'source_id' => ['column' => 'source_id', 'label' => 'Source Id', 'type' => 'uuid', 'nullable' => false], - 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint Id', 'type' => 'uuid', 'nullable' => false], - 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag Id', 'type' => 'uuid', 'nullable' => false], - 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket Id', 'type' => 'uuid', 'nullable' => false], - 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'uuid', 'nullable' => true], + 'team_type' => ['column' => 'team_type', 'label' => 'Team type', 'type' => 'string', 'nullable' => true], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'uuid', 'nullable' => true], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'uuid', 'nullable' => true], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'uuid', 'nullable' => true], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'uuid', 'nullable' => true], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'uuid', 'nullable' => true], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'uuid', 'nullable' => true], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'uuid', 'nullable' => true], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'uuid', 'nullable' => true], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'uuid', 'nullable' => true], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'uuid', 'nullable' => true], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'uuid', 'nullable' => true], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'uuid', 'nullable' => true], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'uuid', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'team_type' => ['column' => 'team_type', 'label' => 'Team type', 'type' => 'string'], + 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog id', 'type' => 'string'], + 'board_id' => ['column' => 'board_id', 'label' => 'Board id', 'type' => 'string'], + 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic id', 'type' => 'string'], + 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow id', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone id', 'type' => 'string'], + 'note_id' => ['column' => 'note_id', 'label' => 'Note id', 'type' => 'string'], + 'project_id' => ['column' => 'project_id', 'label' => 'Project id', 'type' => 'string'], + 'release_id' => ['column' => 'release_id', 'label' => 'Release id', 'type' => 'string'], + 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap id', 'type' => 'string'], + 'source_id' => ['column' => 'source_id', 'label' => 'Source id', 'type' => 'string'], + 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint id', 'type' => 'string'], + 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag id', 'type' => 'string'], + 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket id', 'type' => 'string'], + 'version_id' => ['column' => 'version_id', 'label' => 'Version id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'start_at' => ['column' => 'start_at', 'label' => 'Start at', 'type' => 'string'], + 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned start at', 'type' => 'string'], + 'end_at' => ['column' => 'end_at', 'label' => 'End at', 'type' => 'string'], + 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned end at', 'type' => 'string'], + 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled at', 'type' => 'string'], + 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed at', 'type' => 'string'], + 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo at', 'type' => 'string'], + 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed at', 'type' => 'string'], + 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed at', 'type' => 'string'], + 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended at', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], + 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], + 'completed' => ['column' => 'completed', 'label' => 'Completed', 'type' => 'boolean'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], + 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], + 'retired' => ['column' => 'retired', 'label' => 'Retired', 'type' => 'boolean'], + 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'backlog' => ['column' => 'backlog', 'label' => 'Backlog', 'type' => 'JSON_OBJECT'], + 'board' => ['column' => 'board', 'label' => 'Board', 'type' => 'JSON_OBJECT'], + 'flow' => ['column' => 'flow', 'label' => 'Flow', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'roadmap' => ['column' => 'roadmap', 'label' => 'Roadmap', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Team/LockRequest.php b/src/Http/Requests/Team/LockRequest.php index 7a6680b..9eab42a 100644 --- a/src/Http/Requests/Team/LockRequest.php +++ b/src/Http/Requests/Team/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,68 +35,76 @@ class StoreRequest extends BaseStoreRequest 'tag_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_teams'; - /** * Prepare the data for validation. * @@ -107,38 +116,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Team/UnlockRequest.php b/src/Http/Requests/Team/UnlockRequest.php index 79e2528..8357ad7 100644 --- a/src/Http/Requests/Team/UnlockRequest.php +++ b/src/Http/Requests/Team/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -34,68 +35,76 @@ class UpdateRequest extends BaseUpdateRequest 'tag_id' => ['nullable', 'uuid'], 'ticket_id' => ['nullable', 'uuid'], 'version_id' => ['nullable', 'uuid'], + 'start_at' => ['nullable', 'string'], + 'planned_start_at' => ['nullable', 'string'], + 'end_at' => ['nullable', 'string'], + 'planned_end_at' => ['nullable', 'string'], + 'canceled_at' => ['nullable', 'string'], + 'closed_at' => ['nullable', 'string'], + 'embargo_at' => ['nullable', 'string'], + 'postponed_at' => ['nullable', 'string'], + 'resumed_at' => ['nullable', 'string'], + 'suspended_at' => ['nullable', 'string'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], + 'canceled' => ['boolean'], + 'closed' => ['boolean'], + 'completed' => ['boolean'], + 'cron' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], + 'backlog' => ['nullable', 'array'], + 'board' => ['nullable', 'array'], + 'flow' => ['nullable', 'array'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_teams'; - /** * Prepare the data for validation. * @@ -107,38 +116,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Ticket/CreateRequest.php b/src/Http/Requests/Ticket/CreateRequest.php index 475b9d5..ca13a0f 100644 --- a/src/Http/Requests/Ticket/CreateRequest.php +++ b/src/Http/Requests/Ticket/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'ticket_type' => ['nullable', 'string'], - 'duplicate_id' => ['nullable', 'uuid'], 'backlog_id' => ['nullable', 'uuid'], 'board_id' => ['nullable', 'uuid'], 'completed_by_id' => ['nullable', 'uuid'], + 'duplicate_id' => ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], + 'fixed_by_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -36,8 +38,8 @@ class CreateRequest extends FormRequest 'sprint_id' => ['nullable', 'uuid'], 'tag_id' => ['nullable', 'uuid'], 'team_id' => ['nullable', 'uuid'], - 'version_id' => ['nullable', 'uuid'], 'version_fixed_id' => ['nullable', 'uuid'], + 'version_id' => ['nullable', 'uuid'], 'start_at' => ['nullable', 'string'], 'planned_start_at' => ['nullable', 'string'], 'end_at' => ['nullable', 'string'], @@ -63,10 +65,22 @@ class CreateRequest extends FormRequest 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'canceled' => ['boolean'], 'closed' => ['boolean'], 'completed' => ['boolean'], + 'cron' => ['boolean'], 'duplicate' => ['boolean'], 'fixed' => ['boolean'], 'flagged' => ['boolean'], @@ -74,6 +88,7 @@ class CreateRequest extends FormRequest 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], + 'prioritized' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], 'released' => ['boolean'], @@ -90,10 +105,7 @@ class CreateRequest extends FormRequest 'introduction' => ['string'], 'content' => ['nullable', 'string'], 'summary' => ['nullable', 'string'], - 'key' => ['string'], 'handler' => ['string'], - 'code' => ['integer'], - 'key_code_hash' => ['string'], 'priority' => ['string'], 'severity' => ['string'], 'resolution' => ['string'], @@ -101,7 +113,10 @@ class CreateRequest extends FormRequest 'state' => ['string'], 'workflow_type' => ['string'], 'points' => ['integer'], + 'actual' => ['nullable', 'string'], + 'expected' => ['nullable', 'string'], 'story' => ['nullable', 'string'], + 'steps' => ['nullable', 'string'], 'criteria' => ['nullable', 'string'], 'reproducibility' => ['nullable', 'decimal'], 'icon' => ['string'], diff --git a/src/Http/Requests/Ticket/DestroyRequest.php b/src/Http/Requests/Ticket/DestroyRequest.php index 5c9d39a..35a31d7 100644 --- a/src/Http/Requests/Ticket/DestroyRequest.php +++ b/src/Http/Requests/Ticket/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'ticket_type' => ['nullable', 'string'], - 'duplicate_id' => ['nullable', 'uuid'], 'backlog_id' => ['nullable', 'uuid'], 'board_id' => ['nullable', 'uuid'], 'completed_by_id' => ['nullable', 'uuid'], + 'duplicate_id' => ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], + 'fixed_by_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -36,8 +38,8 @@ class EditRequest extends FormRequest 'sprint_id' => ['nullable', 'uuid'], 'tag_id' => ['nullable', 'uuid'], 'team_id' => ['nullable', 'uuid'], - 'version_id' => ['nullable', 'uuid'], 'version_fixed_id' => ['nullable', 'uuid'], + 'version_id' => ['nullable', 'uuid'], 'start_at' => ['nullable', 'string'], 'planned_start_at' => ['nullable', 'string'], 'end_at' => ['nullable', 'string'], @@ -63,10 +65,22 @@ class EditRequest extends FormRequest 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'canceled' => ['boolean'], 'closed' => ['boolean'], 'completed' => ['boolean'], + 'cron' => ['boolean'], 'duplicate' => ['boolean'], 'fixed' => ['boolean'], 'flagged' => ['boolean'], @@ -74,6 +88,7 @@ class EditRequest extends FormRequest 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], + 'prioritized' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], 'released' => ['boolean'], @@ -90,10 +105,7 @@ class EditRequest extends FormRequest 'introduction' => ['string'], 'content' => ['nullable', 'string'], 'summary' => ['nullable', 'string'], - 'key' => ['string'], 'handler' => ['string'], - 'code' => ['integer'], - 'key_code_hash' => ['string'], 'priority' => ['string'], 'severity' => ['string'], 'resolution' => ['string'], @@ -101,7 +113,10 @@ class EditRequest extends FormRequest 'state' => ['string'], 'workflow_type' => ['string'], 'points' => ['integer'], + 'actual' => ['nullable', 'string'], + 'expected' => ['nullable', 'string'], 'story' => ['nullable', 'string'], + 'steps' => ['nullable', 'string'], 'criteria' => ['nullable', 'string'], 'reproducibility' => ['nullable', 'decimal'], 'icon' => ['string'], diff --git a/src/Http/Requests/Ticket/IndexRequest.php b/src/Http/Requests/Ticket/IndexRequest.php index f9ef78d..e08a0ff 100644 --- a/src/Http/Requests/Ticket/IndexRequest.php +++ b/src/Http/Requests/Ticket/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => true], @@ -37,13 +37,14 @@ class IndexRequest extends BaseIndexRequest ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'icon' => 'fa-regular fa-clock'], 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], @@ -52,6 +53,7 @@ class IndexRequest extends BaseIndexRequest 'pending' => ['column' => 'pending', 'label' => 'Pending', 'icon' => 'fa-solid fa-circle-pause text-warning'], 'planned' => ['column' => 'planned', 'label' => 'Planned', 'icon' => 'fa-solid fa-circle-pause text-success'], 'problem' => ['column' => 'problem', 'label' => 'Problem', 'icon' => 'fa-solid fa-triangle-exclamation text-danger'], + 'prioritized' => ['column' => 'prioritized', 'label' => 'Prioritized', 'icon' => 'fa-solid fa-triangle-exclamation text-success'], 'published' => ['column' => 'published', 'label' => 'Published', 'icon' => 'fa-solid fa-book'], 'released' => ['column' => 'released', 'label' => 'Released', 'icon' => 'fa-solid fa-dove'], 'retired' => ['column' => 'retired', 'label' => 'Retired', 'icon' => 'fa-solid fa-chair text-success'], @@ -61,7 +63,7 @@ class IndexRequest extends BaseIndexRequest ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], @@ -70,12 +72,14 @@ class IndexRequest extends BaseIndexRequest 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => true], 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => true], 'ticket_type' => ['column' => 'ticket_type', 'label' => 'Ticket Type', 'type' => 'string', 'nullable' => true], - 'duplicate_id' => ['column' => 'duplicate_id', 'label' => 'Duplicate Id', 'type' => 'uuid', 'nullable' => true], 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog Id', 'type' => 'uuid', 'nullable' => true], 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'uuid', 'nullable' => true], 'completed_by_id' => ['column' => 'completed_by_id', 'label' => 'Completed By Id', 'type' => 'uuid', 'nullable' => true], + 'duplicate_id' => ['column' => 'duplicate_id', 'label' => 'Duplicate Id', 'type' => 'uuid', 'nullable' => true], 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'uuid', 'nullable' => true], + 'fixed_by_id' => ['column' => 'fixed_by_id', 'label' => 'Fixed by id', 'type' => 'uuid', 'nullable' => true], 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'uuid', 'nullable' => true], 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => true], 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'uuid', 'nullable' => true], @@ -91,7 +95,7 @@ class IndexRequest extends BaseIndexRequest ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], @@ -114,13 +118,16 @@ class IndexRequest extends BaseIndexRequest 'state' => ['column' => 'state', 'label' => 'State', 'type' => 'string', 'nullable' => false], 'workflow_type' => ['column' => 'workflow_type', 'label' => 'Workflow Type', 'type' => 'string', 'nullable' => false], 'points' => ['column' => 'points', 'label' => 'Points', 'type' => 'tinyInteger', 'nullable' => false], + 'actual' => ['column' => 'actual', 'label' => 'Actual', 'type' => 'mediumText', 'nullable' => true], + 'expected' => ['column' => 'expected', 'label' => 'Expected', 'type' => 'mediumText', 'nullable' => true], + 'steps' => ['column' => 'steps', 'label' => 'Steps', 'type' => 'mediumText', 'nullable' => true], 'story' => ['column' => 'story', 'label' => 'Story', 'type' => 'mediumText', 'nullable' => true], 'criteria' => ['column' => 'criteria', 'label' => 'Criteria', 'type' => 'mediumText', 'nullable' => true], 'reproducibility' => ['column' => 'reproducibility', 'label' => 'Reproducibility', 'type' => 'decimal', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $sortable = [ 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'string'], @@ -134,7 +141,9 @@ class IndexRequest extends BaseIndexRequest 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'string'], 'completed_by_id' => ['column' => 'completed_by_id', 'label' => 'Completed By Id', 'type' => 'string'], 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'string'], + 'fixed_by_id' => ['column' => 'fixed_by_id', 'label' => 'Fixed by id', 'type' => 'string'], 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'string'], 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'string'], 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'string'], @@ -175,6 +184,17 @@ class IndexRequest extends BaseIndexRequest 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'type' => 'boolean'], 'closed' => ['column' => 'closed', 'label' => 'Closed', 'type' => 'boolean'], @@ -186,6 +206,7 @@ class IndexRequest extends BaseIndexRequest 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], 'pending' => ['column' => 'pending', 'label' => 'Pending', 'type' => 'boolean'], 'planned' => ['column' => 'planned', 'label' => 'Planned', 'type' => 'boolean'], + 'prioritized' => ['column' => 'prioritized', 'label' => 'Prioritized', 'type' => 'boolean'], 'problem' => ['column' => 'problem', 'label' => 'Problem', 'type' => 'boolean'], 'published' => ['column' => 'published', 'label' => 'Published', 'type' => 'boolean'], 'released' => ['column' => 'released', 'label' => 'Released', 'type' => 'boolean'], @@ -219,5 +240,20 @@ class IndexRequest extends BaseIndexRequest 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'cron' => ['column' => 'cron', 'label' => 'Cron', 'type' => 'boolean'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'backlog' => ['column' => 'backlog', 'label' => 'Backlog', 'type' => 'JSON_OBJECT'], + 'board' => ['column' => 'board', 'label' => 'Board', 'type' => 'JSON_OBJECT'], + 'flow' => ['column' => 'flow', 'label' => 'Flow', 'type' => 'JSON_OBJECT'], + 'history' => ['column' => 'history', 'label' => 'History', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'roadmap' => ['column' => 'roadmap', 'label' => 'Roadmap', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], + 'actual' => ['column' => 'actual', 'label' => 'Actual', 'type' => 'string'], + 'expected' => ['column' => 'expected', 'label' => 'Expected', 'type' => 'string'], + 'steps' => ['column' => 'steps', 'label' => 'Steps', 'type' => 'string'], ]; } diff --git a/src/Http/Requests/Ticket/LockRequest.php b/src/Http/Requests/Ticket/LockRequest.php index 85e6831..5a4c0a3 100644 --- a/src/Http/Requests/Ticket/LockRequest.php +++ b/src/Http/Requests/Ticket/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'ticket_type' => ['nullable', 'string'], - 'duplicate_id' => ['nullable', 'uuid'], 'backlog_id' => ['nullable', 'uuid'], 'board_id' => ['nullable', 'uuid'], 'completed_by_id' => ['nullable', 'uuid'], + 'duplicate_id' => ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], + 'fixed_by_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -36,8 +38,8 @@ class StoreRequest extends BaseStoreRequest 'sprint_id' => ['nullable', 'uuid'], 'tag_id' => ['nullable', 'uuid'], 'team_id' => ['nullable', 'uuid'], - 'version_id' => ['nullable', 'uuid'], 'version_fixed_id' => ['nullable', 'uuid'], + 'version_id' => ['nullable', 'uuid'], 'start_at' => ['nullable', 'string'], 'planned_start_at' => ['nullable', 'string'], 'end_at' => ['nullable', 'string'], @@ -63,10 +65,22 @@ class StoreRequest extends BaseStoreRequest 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'canceled' => ['boolean'], 'closed' => ['boolean'], 'completed' => ['boolean'], + 'cron' => ['boolean'], 'duplicate' => ['boolean'], 'fixed' => ['boolean'], 'flagged' => ['boolean'], @@ -74,6 +88,7 @@ class StoreRequest extends BaseStoreRequest 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], + 'prioritized' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], 'released' => ['boolean'], @@ -82,7 +97,7 @@ class StoreRequest extends BaseStoreRequest 'suspended' => ['boolean'], 'unknown' => ['boolean'], 'label' => ['string'], - 'title' => ['string'], + 'title' => ['string', 'required'], 'byline' => ['string'], 'slug' => ['nullable', 'string'], 'url' => ['string'], @@ -90,10 +105,7 @@ class StoreRequest extends BaseStoreRequest 'introduction' => ['string'], 'content' => ['nullable', 'string'], 'summary' => ['nullable', 'string'], - 'key' => ['string'], 'handler' => ['string'], - 'code' => ['integer'], - 'key_code_hash' => ['string'], 'priority' => ['string'], 'severity' => ['string'], 'resolution' => ['string'], @@ -101,7 +113,10 @@ class StoreRequest extends BaseStoreRequest 'state' => ['string'], 'workflow_type' => ['string'], 'points' => ['integer'], + 'actual' => ['nullable', 'string'], + 'expected' => ['nullable', 'string'], 'story' => ['nullable', 'string'], + 'steps' => ['nullable', 'string'], 'criteria' => ['nullable', 'string'], 'reproducibility' => ['nullable', 'decimal'], 'icon' => ['string'], @@ -120,8 +135,6 @@ class StoreRequest extends BaseStoreRequest '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_tickets'; - /** * Prepare the data for validation. * @@ -133,38 +146,61 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); + + if ($this->exists('handler')) { + $input['handler'] = $this->filterHtml($this->input('handler')); + } + + if ($this->exists('priority')) { + $input['priority'] = $this->filterHtml($this->input('priority')); + } + + if ($this->exists('resolution')) { + $input['resolution'] = $this->filterHtml($this->input('resolution')); } - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); + if ($this->exists('severity')) { + $input['severity'] = $this->filterHtml($this->input('severity')); } - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; + if ($this->exists('step')) { + $input['step'] = $this->filterHtml($this->input('step')); } - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; + if ($this->exists('state')) { + $input['state'] = $this->filterHtml($this->input('state')); + } + + if ($this->exists('workflow_type')) { + $input['workflow_type'] = $this->filterHtml($this->input('workflow_type')); + } + + if ($this->filled('actual')) { + $input['actual'] = $this->purify($this->input('actual')); + } + + if ($this->filled('expected')) { + $input['expected'] = $this->purify($this->input('expected')); + } + + if ($this->filled('steps')) { + $input['steps'] = $this->purify($this->input('steps')); + } + + if ($this->filled('story')) { + $input['story'] = $this->purify($this->input('story')); + } + + if ($this->filled('criteria')) { + $input['criteria'] = $this->purify($this->input('criteria')); } if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Ticket/UnlockRequest.php b/src/Http/Requests/Ticket/UnlockRequest.php index 27e6ae9..4f3c5dc 100644 --- a/src/Http/Requests/Ticket/UnlockRequest.php +++ b/src/Http/Requests/Ticket/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'ticket_type' => ['nullable', 'string'], - 'duplicate_id' => ['nullable', 'uuid'], 'backlog_id' => ['nullable', 'uuid'], 'board_id' => ['nullable', 'uuid'], 'completed_by_id' => ['nullable', 'uuid'], + 'duplicate_id' => ['nullable', 'uuid'], 'epic_id' => ['nullable', 'uuid'], + 'fixed_by_id' => ['nullable', 'uuid'], 'flow_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'milestone_id' => ['nullable', 'uuid'], 'note_id' => ['nullable', 'uuid'], 'project_id' => ['nullable', 'uuid'], @@ -36,8 +38,8 @@ class UpdateRequest extends BaseUpdateRequest 'sprint_id' => ['nullable', 'uuid'], 'tag_id' => ['nullable', 'uuid'], 'team_id' => ['nullable', 'uuid'], - 'version_id' => ['nullable', 'uuid'], 'version_fixed_id' => ['nullable', 'uuid'], + 'version_id' => ['nullable', 'uuid'], 'start_at' => ['nullable', 'string'], 'planned_start_at' => ['nullable', 'string'], 'end_at' => ['nullable', 'string'], @@ -63,10 +65,22 @@ class UpdateRequest extends BaseUpdateRequest 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'canceled' => ['boolean'], 'closed' => ['boolean'], 'completed' => ['boolean'], + 'cron' => ['boolean'], 'duplicate' => ['boolean'], 'fixed' => ['boolean'], 'flagged' => ['boolean'], @@ -74,6 +88,7 @@ class UpdateRequest extends BaseUpdateRequest 'locked' => ['boolean'], 'pending' => ['boolean'], 'planned' => ['boolean'], + 'prioritized' => ['boolean'], 'problem' => ['boolean'], 'published' => ['boolean'], 'released' => ['boolean'], @@ -82,7 +97,7 @@ class UpdateRequest extends BaseUpdateRequest 'suspended' => ['boolean'], 'unknown' => ['boolean'], 'label' => ['string'], - 'title' => ['string'], + 'title' => ['string', 'required'], 'byline' => ['string'], 'slug' => ['nullable', 'string'], 'url' => ['string'], @@ -90,10 +105,7 @@ class UpdateRequest extends BaseUpdateRequest 'introduction' => ['string'], 'content' => ['nullable', 'string'], 'summary' => ['nullable', 'string'], - 'key' => ['string'], 'handler' => ['string'], - 'code' => ['integer'], - 'key_code_hash' => ['string'], 'priority' => ['string'], 'severity' => ['string'], 'resolution' => ['string'], @@ -101,7 +113,10 @@ class UpdateRequest extends BaseUpdateRequest 'state' => ['string'], 'workflow_type' => ['string'], 'points' => ['integer'], + 'actual' => ['nullable', 'string'], + 'expected' => ['nullable', 'string'], 'story' => ['nullable', 'string'], + 'steps' => ['nullable', 'string'], 'criteria' => ['nullable', 'string'], 'reproducibility' => ['nullable', 'decimal'], 'icon' => ['string'], @@ -120,8 +135,6 @@ class UpdateRequest extends BaseUpdateRequest '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_tickets'; - /** * Prepare the data for validation. * @@ -133,38 +146,61 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); + + if ($this->exists('handler')) { + $input['handler'] = $this->filterHtml($this->input('handler')); + } + + if ($this->exists('priority')) { + $input['priority'] = $this->filterHtml($this->input('priority')); + } + + if ($this->exists('resolution')) { + $input['resolution'] = $this->filterHtml($this->input('resolution')); } - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); + if ($this->exists('severity')) { + $input['severity'] = $this->filterHtml($this->input('severity')); } - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; + if ($this->exists('step')) { + $input['step'] = $this->filterHtml($this->input('step')); } - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; + if ($this->exists('state')) { + $input['state'] = $this->filterHtml($this->input('state')); + } + + if ($this->exists('workflow_type')) { + $input['workflow_type'] = $this->filterHtml($this->input('workflow_type')); + } + + if ($this->filled('actual')) { + $input['actual'] = $this->purify($this->input('actual')); + } + + if ($this->filled('expected')) { + $input['expected'] = $this->purify($this->input('expected')); + } + + if ($this->filled('steps')) { + $input['steps'] = $this->purify($this->input('steps')); + } + + if ($this->filled('story')) { + $input['story'] = $this->purify($this->input('story')); + } + + if ($this->filled('criteria')) { + $input['criteria'] = $this->purify($this->input('criteria')); } if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Version/CreateRequest.php b/src/Http/Requests/Version/CreateRequest.php index 99c919f..9c8c4e7 100644 --- a/src/Http/Requests/Version/CreateRequest.php +++ b/src/Http/Requests/Version/CreateRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'version_type' => ['nullable', 'string'], - 'backlog_id' => ['nullable', 'uuid'], - 'board_id' => ['nullable', 'uuid'], - 'epic_id' => ['nullable', 'uuid'], - 'flow_id' => ['nullable', 'uuid'], - 'milestone_id' => ['nullable', 'uuid'], - 'note_id' => ['nullable', 'uuid'], - 'project_id' => ['nullable', 'uuid'], - 'release_id' => ['nullable', 'uuid'], - 'roadmap_id' => ['nullable', 'uuid'], - 'source_id' => ['nullable', 'uuid'], - 'sprint_id' => ['nullable', 'uuid'], - 'tag_id' => ['nullable', 'uuid'], - 'team_id' => ['nullable', 'uuid'], - 'ticket_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], - 'pending' => ['boolean'], - 'planned' => ['boolean'], - 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], - 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; diff --git a/src/Http/Requests/Version/DestroyRequest.php b/src/Http/Requests/Version/DestroyRequest.php index 400f7af..46b22a7 100644 --- a/src/Http/Requests/Version/DestroyRequest.php +++ b/src/Http/Requests/Version/DestroyRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'version_type' => ['nullable', 'string'], - 'backlog_id' => ['nullable', 'uuid'], - 'board_id' => ['nullable', 'uuid'], - 'epic_id' => ['nullable', 'uuid'], - 'flow_id' => ['nullable', 'uuid'], - 'milestone_id' => ['nullable', 'uuid'], - 'note_id' => ['nullable', 'uuid'], - 'project_id' => ['nullable', 'uuid'], - 'release_id' => ['nullable', 'uuid'], - 'roadmap_id' => ['nullable', 'uuid'], - 'source_id' => ['nullable', 'uuid'], - 'sprint_id' => ['nullable', 'uuid'], - 'tag_id' => ['nullable', 'uuid'], - 'team_id' => ['nullable', 'uuid'], - 'ticket_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], - 'pending' => ['boolean'], - 'planned' => ['boolean'], - 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], - 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; diff --git a/src/Http/Requests/Version/IndexRequest.php b/src/Http/Requests/Version/IndexRequest.php index 906d7f1..d319029 100644 --- a/src/Http/Requests/Version/IndexRequest.php +++ b/src/Http/Requests/Version/IndexRequest.php @@ -1,9 +1,9 @@ + * @var array> */ protected array $paginationDates = [ - 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], - 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], - 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'nullable' => true], - 'start_at' => ['column' => 'start_at', 'label' => 'Start At', 'nullable' => true], - 'planned_start_at' => ['column' => 'planned_start_at', 'label' => 'Planned Start At', 'nullable' => true], - 'end_at' => ['column' => 'end_at', 'label' => 'End At', 'nullable' => true], - 'planned_end_at' => ['column' => 'planned_end_at', 'label' => 'Planned End At', 'nullable' => true], - 'canceled_at' => ['column' => 'canceled_at', 'label' => 'Canceled At', 'nullable' => true], - 'closed_at' => ['column' => 'closed_at', 'label' => 'Closed At', 'nullable' => true], - 'embargo_at' => ['column' => 'embargo_at', 'label' => 'Embargo At', 'nullable' => true], - 'fixed_at' => ['column' => 'fixed_at', 'label' => 'Fixed At', 'nullable' => true], - 'postponed_at' => ['column' => 'postponed_at', 'label' => 'Postponed At', 'nullable' => true], - 'published_at' => ['column' => 'published_at', 'label' => 'Published At', 'nullable' => true], - 'released_at' => ['column' => 'released_at', 'label' => 'Released At', 'nullable' => true], - 'resumed_at' => ['column' => 'resumed_at', 'label' => 'Resumed At', 'nullable' => true], - 'resolved_at' => ['column' => 'resolved_at', 'label' => 'Resolved At', 'nullable' => true], - 'suspended_at' => ['column' => 'suspended_at', 'label' => 'Suspended At', 'nullable' => true], + 'created_at' => ['column' => 'created_at', 'label' => 'Created at', 'nullable' => true], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted at', 'nullable' => true], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated at', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationFlags = [ 'active' => ['column' => 'active', 'label' => 'Active', 'icon' => 'fa-solid fa-person-running'], - 'canceled' => ['column' => 'canceled', 'label' => 'Canceled', 'icon' => 'fa-solid fa-ban text-warning'], - 'closed' => ['column' => 'closed', 'label' => 'Closed', 'icon' => 'fa-solid fa-xmark'], - 'completed' => ['column' => 'completed', 'label' => 'Completed', 'icon' => 'fa-solid fa-check'], - 'duplicate' => ['column' => 'duplicate', 'label' => 'Duplicate', 'icon' => 'fa-solid fa-clone'], - 'fixed' => ['column' => 'fixed', 'label' => 'Fixed', 'icon' => 'fa-solid fa-wrench'], 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'icon' => 'fa-solid fa-flag'], 'internal' => ['column' => 'internal', 'label' => 'Internal', 'icon' => 'fa-solid fa-server'], 'locked' => ['column' => 'locked', 'label' => 'Locked', 'icon' => 'fa-solid fa-lock text-warning'], - 'pending' => ['column' => 'pending', 'label' => 'Pending', 'icon' => 'fa-solid fa-circle-pause text-warning'], - 'planned' => ['column' => 'planned', 'label' => 'Planned', 'icon' => 'fa-solid fa-circle-pause text-success'], - 'problem' => ['column' => 'problem', 'label' => 'Problem', 'icon' => 'fa-solid fa-triangle-exclamation text-danger'], - 'published' => ['column' => 'published', 'label' => 'Published', 'icon' => 'fa-solid fa-book'], - 'released' => ['column' => 'released', 'label' => 'Released', 'icon' => 'fa-solid fa-dove'], 'retired' => ['column' => 'retired', 'label' => 'Retired', 'icon' => 'fa-solid fa-chair text-success'], - 'resolved' => ['column' => 'resolved', 'label' => 'Resolved', 'icon' => 'fa-solid fa-check-double text-success'], - 'suspended' => ['column' => 'suspended', 'label' => 'Suspended', 'icon' => 'fa-solid fa-hand text-danger'], 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], - 'only_admin' => ['column' => 'only_admin', 'label' => 'Only Admin', 'icon' => 'fa-solid fa-user-gear'], - 'only_user' => ['column' => 'only_user', 'label' => 'Only User', 'icon' => 'fa-solid fa-user'], - 'only_guest' => ['column' => 'only_guest', 'label' => 'Only Guest', 'icon' => 'fa-solid fa-person-rays'], - 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; /** - * @var array + * @var array> */ protected array $paginationIds = [ - 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], - 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned By Id', 'type' => 'uuid', 'nullable' => false], - 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent Id', 'type' => 'uuid', 'nullable' => false], - 'version_type' => ['column' => 'version_type', 'label' => 'Version Type', 'type' => 'string', 'nullable' => true], - 'backlog_id' => ['column' => 'backlog_id', 'label' => 'Backlog Id', 'type' => 'uuid', 'nullable' => false], - 'board_id' => ['column' => 'board_id', 'label' => 'Board Id', 'type' => 'uuid', 'nullable' => false], - 'epic_id' => ['column' => 'epic_id', 'label' => 'Epic Id', 'type' => 'uuid', 'nullable' => false], - 'flow_id' => ['column' => 'flow_id', 'label' => 'Flow Id', 'type' => 'uuid', 'nullable' => false], - 'milestone_id' => ['column' => 'milestone_id', 'label' => 'Milestone Id', 'type' => 'uuid', 'nullable' => false], - 'note_id' => ['column' => 'note_id', 'label' => 'Note Id', 'type' => 'uuid', 'nullable' => false], - 'project_id' => ['column' => 'project_id', 'label' => 'Project Id', 'type' => 'uuid', 'nullable' => false], - 'release_id' => ['column' => 'release_id', 'label' => 'Release Id', 'type' => 'uuid', 'nullable' => false], - 'roadmap_id' => ['column' => 'roadmap_id', 'label' => 'Roadmap Id', 'type' => 'uuid', 'nullable' => false], - 'source_id' => ['column' => 'source_id', 'label' => 'Source Id', 'type' => 'uuid', 'nullable' => false], - 'sprint_id' => ['column' => 'sprint_id', 'label' => 'Sprint Id', 'type' => 'uuid', 'nullable' => false], - 'tag_id' => ['column' => 'tag_id', 'label' => 'Tag Id', 'type' => 'uuid', 'nullable' => false], - 'team_id' => ['column' => 'team_id', 'label' => 'Team Id', 'type' => 'uuid', 'nullable' => false], - 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket Id', 'type' => 'uuid', 'nullable' => false], + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'uuid', 'nullable' => true], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'uuid', 'nullable' => true], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'uuid', 'nullable' => true], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'uuid', 'nullable' => true], + 'version_type' => ['column' => 'version_type', 'label' => 'Version type', 'type' => 'string', 'nullable' => true], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'uuid', 'nullable' => true], ]; /** - * @var array + * @var array> */ protected array $paginationColumns = [ - 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], - 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], - 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => false], - 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => false], - 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => false], - 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => false], - 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string', 'nullable' => false], - 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string', 'nullable' => false], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => true], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => true], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => true], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string', 'nullable' => true], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string', 'nullable' => true], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string', 'nullable' => true], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string', 'nullable' => true], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'mediumText', 'nullable' => true], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], + ]; + + /** + * @var array> + */ + protected array $sortable = [ + 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created by id', 'type' => 'string'], + 'modified_by_id' => ['column' => 'modified_by_id', 'label' => 'Modified by id', 'type' => 'string'], + 'owned_by_id' => ['column' => 'owned_by_id', 'label' => 'Owned by id', 'type' => 'string'], + 'parent_id' => ['column' => 'parent_id', 'label' => 'Parent id', 'type' => 'string'], + 'version_type' => ['column' => 'version_type', 'label' => 'Version type', 'type' => 'string'], + 'matrix_id' => ['column' => 'matrix_id', 'label' => 'Matrix id', 'type' => 'string'], + 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'type' => 'string'], + 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'type' => 'string'], + 'deleted_at' => ['column' => 'deleted_at', 'label' => 'Deleted At', 'type' => 'string'], + 'gids' => ['column' => 'gids', 'label' => 'Gids', 'type' => 'integer'], + 'po' => ['column' => 'po', 'label' => 'Po', 'type' => 'integer'], + 'pg' => ['column' => 'pg', 'label' => 'Pg', 'type' => 'integer'], + 'pw' => ['column' => 'pw', 'label' => 'Pw', 'type' => 'integer'], + 'only_admin' => ['column' => 'only_admin', 'label' => 'Only admin', 'type' => 'boolean'], + 'only_user' => ['column' => 'only_user', 'label' => 'Only user', 'type' => 'boolean'], + 'only_guest' => ['column' => 'only_guest', 'label' => 'Only guest', 'type' => 'boolean'], + 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow public', 'type' => 'boolean'], + 'status' => ['column' => 'status', 'label' => 'Status', 'type' => 'integer'], + 'rank' => ['column' => 'rank', 'label' => 'Rank', 'type' => 'integer'], + 'size' => ['column' => 'size', 'label' => 'Size', 'type' => 'integer'], + 'matrix' => ['column' => 'matrix', 'label' => 'Matrix', 'type' => 'JSON_OBJECT'], + 'x' => ['column' => 'x', 'label' => 'X', 'type' => 'integer'], + 'y' => ['column' => 'y', 'label' => 'Y', 'type' => 'integer'], + 'z' => ['column' => 'z', 'label' => 'Z', 'type' => 'integer'], + 'r' => ['column' => 'r', 'label' => 'R', 'type' => 'float'], + 'theta' => ['column' => 'theta', 'label' => 'Theta', 'type' => 'float'], + 'rho' => ['column' => 'rho', 'label' => 'Rho', 'type' => 'float'], + 'phi' => ['column' => 'phi', 'label' => 'Phi', 'type' => 'float'], + 'elevation' => ['column' => 'elevation', 'label' => 'Elevation', 'type' => 'float'], + 'latitude' => ['column' => 'latitude', 'label' => 'Latitude', 'type' => 'float'], + 'longitude' => ['column' => 'longitude', 'label' => 'Longitude', 'type' => 'float'], + 'active' => ['column' => 'active', 'label' => 'Active', 'type' => 'boolean'], + 'flagged' => ['column' => 'flagged', 'label' => 'Flagged', 'type' => 'boolean'], + 'internal' => ['column' => 'internal', 'label' => 'Internal', 'type' => 'boolean'], + 'locked' => ['column' => 'locked', 'label' => 'Locked', 'type' => 'boolean'], + 'retired' => ['column' => 'retired', 'label' => 'Retired', 'type' => 'boolean'], + 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'type' => 'boolean'], + 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string'], + 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string'], + 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string'], + 'slug' => ['column' => 'slug', 'label' => 'Slug', 'type' => 'string'], + 'url' => ['column' => 'url', 'label' => 'Url', 'type' => 'string'], + 'description' => ['column' => 'description', 'label' => 'Description', 'type' => 'string'], + 'introduction' => ['column' => 'introduction', 'label' => 'Introduction', 'type' => 'string'], + 'content' => ['column' => 'content', 'label' => 'Content', 'type' => 'string'], + 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'string'], + 'icon' => ['column' => 'icon', 'label' => 'Icon', 'type' => 'string'], + 'image' => ['column' => 'image', 'label' => 'Image', 'type' => 'string'], + 'avatar' => ['column' => 'avatar', 'label' => 'Avatar', 'type' => 'string'], + 'ui' => ['column' => 'ui', 'label' => 'Ui', 'type' => 'JSON_OBJECT'], + 'assets' => ['column' => 'assets', 'label' => 'Assets', 'type' => 'JSON_OBJECT'], + 'meta' => ['column' => 'meta', 'label' => 'Meta', 'type' => 'JSON_OBJECT'], + 'notes' => ['column' => 'notes', 'label' => 'Notes', 'type' => 'JSON_ARRAY'], + 'options' => ['column' => 'options', 'label' => 'Options', 'type' => 'JSON_OBJECT'], + 'sources' => ['column' => 'sources', 'label' => 'Sources', 'type' => 'JSON_OBJECT'], ]; } diff --git a/src/Http/Requests/Version/LockRequest.php b/src/Http/Requests/Version/LockRequest.php index 267f13f..10f335d 100644 --- a/src/Http/Requests/Version/LockRequest.php +++ b/src/Http/Requests/Version/LockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'version_type' => ['nullable', 'string'], - 'backlog_id' => ['nullable', 'uuid'], - 'board_id' => ['nullable', 'uuid'], - 'epic_id' => ['nullable', 'uuid'], - 'flow_id' => ['nullable', 'uuid'], - 'milestone_id' => ['nullable', 'uuid'], - 'note_id' => ['nullable', 'uuid'], - 'project_id' => ['nullable', 'uuid'], - 'release_id' => ['nullable', 'uuid'], - 'roadmap_id' => ['nullable', 'uuid'], - 'source_id' => ['nullable', 'uuid'], - 'sprint_id' => ['nullable', 'uuid'], - 'tag_id' => ['nullable', 'uuid'], - 'team_id' => ['nullable', 'uuid'], - 'ticket_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], - 'pending' => ['boolean'], - 'planned' => ['boolean'], - 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], - 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_versions'; - /** * Prepare the data for validation. * @@ -107,38 +80,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Requests/Version/UnlockRequest.php b/src/Http/Requests/Version/UnlockRequest.php index 6aea205..f596779 100644 --- a/src/Http/Requests/Version/UnlockRequest.php +++ b/src/Http/Requests/Version/UnlockRequest.php @@ -1,9 +1,9 @@ ['nullable', 'uuid'], 'parent_id' => ['nullable', 'uuid'], 'version_type' => ['nullable', 'string'], - 'backlog_id' => ['nullable', 'uuid'], - 'board_id' => ['nullable', 'uuid'], - 'epic_id' => ['nullable', 'uuid'], - 'flow_id' => ['nullable', 'uuid'], - 'milestone_id' => ['nullable', 'uuid'], - 'note_id' => ['nullable', 'uuid'], - 'project_id' => ['nullable', 'uuid'], - 'release_id' => ['nullable', 'uuid'], - 'roadmap_id' => ['nullable', 'uuid'], - 'source_id' => ['nullable', 'uuid'], - 'sprint_id' => ['nullable', 'uuid'], - 'tag_id' => ['nullable', 'uuid'], - 'team_id' => ['nullable', 'uuid'], - 'ticket_id' => ['nullable', 'uuid'], + 'matrix_id' => ['nullable', 'uuid'], 'gids' => ['integer'], 'po' => ['integer'], 'pg' => ['integer'], 'pw' => ['integer'], + 'only_admin' => ['boolean'], + 'only_user' => ['boolean'], + 'only_guest' => ['boolean'], + 'allow_public' => ['boolean'], 'status' => ['integer'], 'rank' => ['integer'], 'size' => ['integer'], - 'label' => ['string'], - 'byline' => ['string'], - 'slug' => ['nullable', 'string'], - 'content' => ['nullable', 'string'], - 'description' => ['string'], - 'introduction' => ['string'], - 'summary' => ['nullable', 'string'], - 'url' => ['string'], + 'matrix' => ['nullable', 'array'], + 'x' => ['nullable', 'integer'], + 'y' => ['nullable', 'integer'], + 'z' => ['nullable', 'integer'], + 'r' => ['nullable', 'numeric'], + 'theta' => ['nullable', 'numeric'], + 'rho' => ['nullable', 'numeric'], + 'phi' => ['nullable', 'numeric'], + 'elevation' => ['nullable', 'numeric'], + 'latitude' => ['nullable', 'numeric'], + 'longitude' => ['nullable', 'numeric'], 'active' => ['boolean'], 'flagged' => ['boolean'], 'internal' => ['boolean'], 'locked' => ['boolean'], - 'pending' => ['boolean'], - 'planned' => ['boolean'], - 'problem' => ['boolean'], - 'published' => ['boolean'], 'retired' => ['boolean'], - 'suspended' => ['boolean'], 'unknown' => ['boolean'], - 'only_admin' => ['boolean'], - 'only_user' => ['boolean'], - 'only_guest' => ['boolean'], - 'allow_public' => ['boolean'], - 'ui' => ['nullable', 'array'], + 'label' => ['string'], + 'title' => ['string', 'required'], + 'byline' => ['string'], + 'slug' => ['nullable', 'string'], + 'url' => ['string'], + 'description' => ['string'], + 'introduction' => ['string'], + 'content' => ['nullable', 'string'], + 'summary' => ['nullable', 'string'], 'icon' => ['string'], 'image' => ['string'], 'avatar' => ['string'], - 'start_at' => ['nullable', 'string'], - 'planned_start_at' => ['nullable', 'string'], - 'end_at' => ['nullable', 'string'], - 'planned_end_at' => ['nullable', 'string'], - 'canceled_at' => ['nullable', 'string'], - 'closed_at' => ['nullable', 'string'], - 'embargo_at' => ['nullable', 'string'], - 'fixed_at' => ['nullable', 'string'], - 'postponed_at' => ['nullable', 'string'], - 'published_at' => ['nullable', 'string'], - 'released_at' => ['nullable', 'string'], - 'resolved_at' => ['nullable', 'string'], - 'resumed_at' => ['nullable', 'string'], - 'suspended_at' => ['nullable', 'string'], + 'ui' => ['nullable', 'array'], 'assets' => ['nullable', 'array'], - 'backlog' => ['nullable', 'string'], - 'board' => ['nullable', 'string'], - 'flow' => ['nullable', 'string'], 'meta' => ['nullable', 'array'], - 'notes' => ['nullable', 'array'], 'options' => ['nullable', 'array'], - 'roadmap' => ['nullable', 'array'], 'sources' => ['nullable', 'array'], '_return_url' => ['nullable', 'url'], ]; - protected string $slug_table = 'matrix_versions'; - /** * Prepare the data for validation. * @@ -107,38 +80,13 @@ protected function prepareForValidation() $input = []; - if ($this->filled('content')) { - $input['content'] = $this->purify($this->input('content')); - } - - if ($this->filled('summary')) { - $input['summary'] = $this->purify($this->input('summary')); - } - - if ($this->filled('description')) { - $input['description'] = $this->exorcise($this->input('description')); - } elseif ($this->has('description')) { - $input['description'] = ''; - } - - if ($this->filled('introduction')) { - $input['introduction'] = $this->exorcise($this->input('introduction')); - } elseif ($this->has('introduction')) { - $input['introduction'] = ''; - } + $this->filterContentFields($input); + $this->filterCommonFields($input); + $this->filterStatus($input); + $this->filterSystemFields($input); if (! empty($input)) { $this->merge($input); } } - - // /** - // * Handle a passed validation attempt. - // * - // * @return void - // */ - // protected function passedValidation() - // { - // - // } } diff --git a/src/Http/Resources/Backlog.php b/src/Http/Resources/Backlog.php index bb26934..c9b8aba 100644 --- a/src/Http/Resources/Backlog.php +++ b/src/Http/Resources/Backlog.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/BacklogCollection.php b/src/Http/Resources/BacklogCollection.php index 0c98344..515e3b6 100644 --- a/src/Http/Resources/BacklogCollection.php +++ b/src/Http/Resources/BacklogCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Board.php b/src/Http/Resources/Board.php index b74acf9..86cf0ae 100644 --- a/src/Http/Resources/Board.php +++ b/src/Http/Resources/Board.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/BoardCollection.php b/src/Http/Resources/BoardCollection.php index c20ed50..d4c437c 100644 --- a/src/Http/Resources/BoardCollection.php +++ b/src/Http/Resources/BoardCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Epic.php b/src/Http/Resources/Epic.php index 06cbf14..7e120d8 100644 --- a/src/Http/Resources/Epic.php +++ b/src/Http/Resources/Epic.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/EpicCollection.php b/src/Http/Resources/EpicCollection.php index 687d23a..4a6f969 100644 --- a/src/Http/Resources/EpicCollection.php +++ b/src/Http/Resources/EpicCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Flow.php b/src/Http/Resources/Flow.php index b3a8d50..f6ee155 100644 --- a/src/Http/Resources/Flow.php +++ b/src/Http/Resources/Flow.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/FlowCollection.php b/src/Http/Resources/FlowCollection.php index 8e4a37a..13f0b51 100644 --- a/src/Http/Resources/FlowCollection.php +++ b/src/Http/Resources/FlowCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Matrix.php b/src/Http/Resources/Matrix.php new file mode 100644 index 0000000..60ae80f --- /dev/null +++ b/src/Http/Resources/Matrix.php @@ -0,0 +1,43 @@ + + */ + public function with(Request $request): array + { + /** + * @var ?MatrixModel $matrix + */ + $matrix = $request->route('matrix'); + + return [ + 'meta' => [ + 'id' => $matrix?->id, + 'rules' => $request->rules(), + 'session_user_id' => $request->user()?->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $request->validated(), + ], + ]; + } +} diff --git a/src/Http/Resources/MatrixCollection.php b/src/Http/Resources/MatrixCollection.php new file mode 100644 index 0000000..59c4fd2 --- /dev/null +++ b/src/Http/Resources/MatrixCollection.php @@ -0,0 +1,41 @@ + + */ + public function with(Request $request): array + { + return [ + 'meta' => [ + 'columns' => $request->getPaginationColumns(), + 'dates' => $request->getPaginationDates(), + 'flags' => $request->getPaginationFlags(), + 'ids' => $request->getPaginationIds(), + 'rules' => $request->rules(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $request->validated(), + ], + ]; + } +} diff --git a/src/Http/Resources/Milestone.php b/src/Http/Resources/Milestone.php index 61d4c47..d19fe76 100644 --- a/src/Http/Resources/Milestone.php +++ b/src/Http/Resources/Milestone.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/MilestoneCollection.php b/src/Http/Resources/MilestoneCollection.php index 0a727eb..dc1ca91 100644 --- a/src/Http/Resources/MilestoneCollection.php +++ b/src/Http/Resources/MilestoneCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Note.php b/src/Http/Resources/Note.php index 076a2d7..f26a908 100644 --- a/src/Http/Resources/Note.php +++ b/src/Http/Resources/Note.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/NoteCollection.php b/src/Http/Resources/NoteCollection.php index 23bd01e..6d273fd 100644 --- a/src/Http/Resources/NoteCollection.php +++ b/src/Http/Resources/NoteCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Project.php b/src/Http/Resources/Project.php index 319217a..f59a659 100644 --- a/src/Http/Resources/Project.php +++ b/src/Http/Resources/Project.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/ProjectCollection.php b/src/Http/Resources/ProjectCollection.php index e6d68ad..5b587ca 100644 --- a/src/Http/Resources/ProjectCollection.php +++ b/src/Http/Resources/ProjectCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Release.php b/src/Http/Resources/Release.php index 116f36b..f9e14b9 100644 --- a/src/Http/Resources/Release.php +++ b/src/Http/Resources/Release.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/ReleaseCollection.php b/src/Http/Resources/ReleaseCollection.php index df6a756..3373d20 100644 --- a/src/Http/Resources/ReleaseCollection.php +++ b/src/Http/Resources/ReleaseCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Roadmap.php b/src/Http/Resources/Roadmap.php index ceabc18..55b2a1e 100644 --- a/src/Http/Resources/Roadmap.php +++ b/src/Http/Resources/Roadmap.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/RoadmapCollection.php b/src/Http/Resources/RoadmapCollection.php index eda191b..5e64ed8 100644 --- a/src/Http/Resources/RoadmapCollection.php +++ b/src/Http/Resources/RoadmapCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Source.php b/src/Http/Resources/Source.php index 264fbcf..dbc1aba 100644 --- a/src/Http/Resources/Source.php +++ b/src/Http/Resources/Source.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/SourceCollection.php b/src/Http/Resources/SourceCollection.php index 8b92f9d..6799dbf 100644 --- a/src/Http/Resources/SourceCollection.php +++ b/src/Http/Resources/SourceCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Sprint.php b/src/Http/Resources/Sprint.php index afb8b6b..2529f74 100644 --- a/src/Http/Resources/Sprint.php +++ b/src/Http/Resources/Sprint.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/SprintCollection.php b/src/Http/Resources/SprintCollection.php index a4627de..39c0e3d 100644 --- a/src/Http/Resources/SprintCollection.php +++ b/src/Http/Resources/SprintCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Tag.php b/src/Http/Resources/Tag.php index c35db9d..344a66b 100644 --- a/src/Http/Resources/Tag.php +++ b/src/Http/Resources/Tag.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/TagCollection.php b/src/Http/Resources/TagCollection.php index 6787889..6a190d3 100644 --- a/src/Http/Resources/TagCollection.php +++ b/src/Http/Resources/TagCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Team.php b/src/Http/Resources/Team.php index b15615a..8e80a30 100644 --- a/src/Http/Resources/Team.php +++ b/src/Http/Resources/Team.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/TeamCollection.php b/src/Http/Resources/TeamCollection.php index 0bf4956..b4c3743 100644 --- a/src/Http/Resources/TeamCollection.php +++ b/src/Http/Resources/TeamCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Ticket.php b/src/Http/Resources/Ticket.php index 523ee4f..cc23a04 100644 --- a/src/Http/Resources/Ticket.php +++ b/src/Http/Resources/Ticket.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/TicketCollection.php b/src/Http/Resources/TicketCollection.php index b724402..b4b2c7a 100644 --- a/src/Http/Resources/TicketCollection.php +++ b/src/Http/Resources/TicketCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/Version.php b/src/Http/Resources/Version.php index a6cffac..7e0262d 100644 --- a/src/Http/Resources/Version.php +++ b/src/Http/Resources/Version.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Http/Resources/VersionCollection.php b/src/Http/Resources/VersionCollection.php index dbbb96e..c56d26d 100644 --- a/src/Http/Resources/VersionCollection.php +++ b/src/Http/Resources/VersionCollection.php @@ -1,4 +1,7 @@ |\Illuminate\Contracts\Support\Arrayable|\JsonSerializable - */ - public function toArray(Request $request) - { - return parent::toArray($request); - } - /** * Get additional data that should be returned with the resource array. * diff --git a/src/Policies/BacklogPolicy.php b/src/Policies/BacklogPolicy.php index bbfb284..ee1d5f9 100644 --- a/src/Policies/BacklogPolicy.php +++ b/src/Policies/BacklogPolicy.php @@ -1,9 +1,9 @@ The roles allowed to view the MVC. + */ + protected $rolesToView = [ + 'user', + 'staff', + 'publisher', + 'manager', + 'admin', + 'root', + ]; + + /** + * @var array The roles allowed for actions in the MVC. + */ + protected $rolesForAction = [ + 'publisher', + 'manager', + 'admin', + 'root', + ]; +} diff --git a/src/Policies/MilestonePolicy.php b/src/Policies/MilestonePolicy.php index f7f4f3d..7950146 100644 --- a/src/Policies/MilestonePolicy.php +++ b/src/Policies/MilestonePolicy.php @@ -1,9 +1,9 @@ loadTranslationsFrom( - // dirname(__DIR__).'/resources/lang', - // 'playground-matrix-resource' - // ); + if (! empty($config['load']['translations'])) { + $this->loadTranslationsFrom( + dirname(__DIR__).'/lang', + $this->package + ); + } if (! empty($config['load']['policies']) && ! empty($config['policies']) @@ -59,25 +60,23 @@ public function boot(): void $this->package ); } + } - if ($this->app->runningInConsole()) { - // Publish configuration - $this->publishes([ - sprintf('%1$s/config/%2$s.php', dirname(__DIR__), $this->package) => config_path(sprintf('%1$s.php', $this->package)), - ], 'playground-config'); + if ($this->app->runningInConsole()) { + // Publish configuration + $this->publishes([ + sprintf('%1$s/config/%2$s.php', dirname(__DIR__), $this->package) => config_path(sprintf('%1$s.php', $this->package)), + ], 'playground-config'); - // Publish routes - $this->publishes([ - dirname(__DIR__).'/routes' => base_path('routes/playground-matrix-resource'), - ], 'playground-routes'); - } + // Publish routes + $this->publishes([ + dirname(__DIR__).'/routes' => base_path('routes/playground-matrix-resource'), + ], 'playground-routes'); } - if (! empty($config['layout']) && is_string($config['layout'])) { - View::share('layout', $config['layout']); + if (! empty($config['about'])) { + $this->about(); } - - $this->about(); } /** @@ -100,8 +99,8 @@ public function setPolicies(array $policies): void { foreach ($policies as $model => $policy) { if (! is_string($model) || ! class_exists($model)) { - Log::error(__METHOD__, [ - 'error' => 'Expecting the model to exist.', + Log::error('Expecting the model to exist for the policy.', [ + '__METHOD__' => __METHOD__, 'model' => is_string($model) ? $model : gettype($model), 'policy' => is_string($policy) ? $policy : gettype($policy), 'policies' => $policies, @@ -110,8 +109,8 @@ public function setPolicies(array $policies): void continue; } if (! is_string($policy) || ! class_exists($policy)) { - Log::error(__METHOD__, [ - 'error' => 'Expecting the policy to exist.', + Log::error('Expecting the policy to exist for the model.', [ + '__METHOD__' => __METHOD__, 'model' => is_string($model) ? $model : gettype($model), 'policy' => is_string($policy) ? $policy : gettype($policy), 'policies' => $policies, @@ -143,6 +142,9 @@ public function routes(array $config): void if (! empty($config['flows'])) { $this->loadRoutesFrom(dirname(__DIR__).'/routes/flows.php'); } + if (! empty($config['matrices'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/matrices.php'); + } if (! empty($config['milestones'])) { $this->loadRoutesFrom(dirname(__DIR__).'/routes/milestones.php'); } @@ -194,6 +196,7 @@ public function about(): void $version = $this->version(); AboutCommand::add('Playground: Matrix Resource', fn () => [ + 'Load Policies' => ! empty($load['policies']) ? 'ENABLED' : 'DISABLED', 'Load Routes' => ! empty($load['routes']) ? 'ENABLED' : 'DISABLED', 'Load Views' => ! empty($load['views']) ? 'ENABLED' : 'DISABLED', @@ -214,6 +217,7 @@ public function about(): void 'Route boards' => ! empty($routes['boards']) ? 'ENABLED' : 'DISABLED', 'Route epics' => ! empty($routes['epics']) ? 'ENABLED' : 'DISABLED', 'Route flows' => ! empty($routes['flows']) ? 'ENABLED' : 'DISABLED', + 'Route matrices' => ! empty($routes['matrices']) ? 'ENABLED' : 'DISABLED', 'Route milestones' => ! empty($routes['milestones']) ? 'ENABLED' : 'DISABLED', 'Route notes' => ! empty($routes['notes']) ? 'ENABLED' : 'DISABLED', 'Route projects' => ! empty($routes['projects']) ? 'ENABLED' : 'DISABLED', diff --git a/tests/Feature/Http/Controllers/BacklogTestCase.php b/tests/Feature/Http/Controllers/BacklogTestCase.php index d5cb234..b197d89 100644 --- a/tests/Feature/Http/Controllers/BacklogTestCase.php +++ b/tests/Feature/Http/Controllers/BacklogTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Backlog', 'model_label_plural' => 'Backlogs', 'model_route' => 'playground.matrix.resource.backlogs', @@ -29,7 +49,7 @@ class BacklogTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:backlog', 'table' => 'matrix_backlogs', - 'view' => 'playground-matrix-resource::backlog', + 'view' => 'playground.matrix.resource::backlog', ]; /** @@ -45,6 +65,7 @@ class BacklogTestCase extends TestCase 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -57,8 +78,8 @@ class BacklogTestCase extends TestCase 'ticket_id', 'version_id', 'created_at', - 'deleted_at', 'updated_at', + 'deleted_at', 'start_at', 'planned_start_at', 'end_at', @@ -84,10 +105,22 @@ class BacklogTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', 'completed', + 'cron', 'duplicate', 'fixed', 'flagged', @@ -120,6 +153,7 @@ class BacklogTestCase extends TestCase 'board', 'flow', 'meta', + 'notes', 'options', 'roadmap', 'sources', diff --git a/tests/Feature/Http/Controllers/BoardTestCase.php b/tests/Feature/Http/Controllers/BoardTestCase.php index 6a5040e..5e33ea5 100644 --- a/tests/Feature/Http/Controllers/BoardTestCase.php +++ b/tests/Feature/Http/Controllers/BoardTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Board', 'model_label_plural' => 'Boards', 'model_route' => 'playground.matrix.resource.boards', @@ -29,7 +49,7 @@ class BoardTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:board', 'table' => 'matrix_boards', - 'view' => 'playground-matrix-resource::board', + 'view' => 'playground.matrix.resource::board', ]; /** @@ -45,6 +65,7 @@ class BoardTestCase extends TestCase 'backlog_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -57,8 +78,8 @@ class BoardTestCase extends TestCase 'ticket_id', 'version_id', 'created_at', - 'deleted_at', 'updated_at', + 'deleted_at', 'start_at', 'planned_start_at', 'end_at', @@ -84,10 +105,22 @@ class BoardTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', 'completed', + 'cron', 'duplicate', 'fixed', 'flagged', @@ -120,6 +153,7 @@ class BoardTestCase extends TestCase 'board', 'flow', 'meta', + 'notes', 'options', 'roadmap', 'sources', diff --git a/tests/Feature/Http/Controllers/EpicTestCase.php b/tests/Feature/Http/Controllers/EpicTestCase.php index 25937b5..db6a25f 100644 --- a/tests/Feature/Http/Controllers/EpicTestCase.php +++ b/tests/Feature/Http/Controllers/EpicTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Epic', 'model_label_plural' => 'Epics', 'model_route' => 'playground.matrix.resource.epics', @@ -29,7 +49,7 @@ class EpicTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:epic', 'table' => 'matrix_epics', - 'view' => 'playground-matrix-resource::epic', + 'view' => 'playground.matrix.resource::epic', ]; /** @@ -42,9 +62,10 @@ class EpicTestCase extends TestCase 'owned_by_id', 'parent_id', 'epic_type', - 'board_id', 'backlog_id', + 'board_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -57,8 +78,8 @@ class EpicTestCase extends TestCase 'ticket_id', 'version_id', 'created_at', - 'deleted_at', 'updated_at', + 'deleted_at', 'start_at', 'planned_start_at', 'end_at', @@ -84,10 +105,22 @@ class EpicTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', 'completed', + 'cron', 'duplicate', 'fixed', 'flagged', @@ -120,6 +153,7 @@ class EpicTestCase extends TestCase 'board', 'flow', 'meta', + 'notes', 'options', 'roadmap', 'sources', diff --git a/tests/Feature/Http/Controllers/FlowTestCase.php b/tests/Feature/Http/Controllers/FlowTestCase.php index 396f559..482774c 100644 --- a/tests/Feature/Http/Controllers/FlowTestCase.php +++ b/tests/Feature/Http/Controllers/FlowTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Flow', 'model_label_plural' => 'Flows', 'model_route' => 'playground.matrix.resource.flows', @@ -29,7 +49,7 @@ class FlowTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:flow', 'table' => 'matrix_flows', - 'view' => 'playground-matrix-resource::flow', + 'view' => 'playground.matrix.resource::flow', ]; /** @@ -42,36 +62,20 @@ class FlowTestCase extends TestCase 'owned_by_id', 'parent_id', 'flow_type', - // 'backlog_id', - // 'board_id', - // 'epic_id', - // 'milestone_id', + 'matrix_id', 'note_id', - // 'project_id', - // 'release_id', - // 'roadmap_id', - // 'source_id', - // 'sprint_id', 'tag_id', 'team_id', - // 'ticket_id', - // 'version_id', 'created_at', - 'deleted_at', 'updated_at', + 'deleted_at', 'start_at', 'planned_start_at', 'end_at', 'planned_end_at', - 'canceled_at', - 'closed_at', 'embargo_at', - // 'fixed_at', 'postponed_at', - 'published_at', - 'released_at', 'resumed_at', - // 'resolved_at', 'suspended_at', 'gids', 'po', @@ -84,22 +88,26 @@ class FlowTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', - 'canceled', - 'closed', - 'completed', - 'duplicate', - 'fixed', + 'cron', 'flagged', 'internal', 'locked', 'pending', 'planned', 'problem', - 'published', - 'released', 'retired', - 'resolved', 'suspended', 'unknown', 'label', @@ -116,12 +124,13 @@ class FlowTestCase extends TestCase 'avatar', 'ui', 'assets', - 'flow', - // 'board', + 'backlog', + 'board', 'flow', 'meta', + 'notes', 'options', - // 'roadmap', - // 'sources', + 'roadmap', + 'sources', ]; } diff --git a/tests/Feature/Http/Controllers/MatrixTestCase.php b/tests/Feature/Http/Controllers/MatrixTestCase.php new file mode 100644 index 0000000..654a534 --- /dev/null +++ b/tests/Feature/Http/Controllers/MatrixTestCase.php @@ -0,0 +1,134 @@ + + */ + public array $packageInfo = [ + 'model_attribute' => 'title', + 'model_label' => 'Matrix', + 'model_label_plural' => 'Matrices', + 'model_route' => 'playground.matrix.resource.matrices', + 'model_slug' => 'matrix', + 'model_slug_plural' => 'matrices', + 'module_label' => 'Matrix', + 'module_label_plural' => 'Matrices', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:matrix', + 'table' => 'matrix_matrices', + 'view' => 'playground.matrix.resource::matrix', + ]; + + /** + * @var array + */ + protected $structure_model = [ + 'id', + 'created_by_id', + 'modified_by_id', + 'owned_by_id', + 'parent_id', + 'matrix_type', + 'matrix_id', + 'created_at', + 'updated_at', + 'deleted_at', + 'start_at', + 'planned_start_at', + 'end_at', + 'planned_end_at', + 'canceled_at', + 'closed_at', + 'embargo_at', + 'postponed_at', + 'resumed_at', + 'suspended_at', + 'gids', + 'po', + 'pg', + 'pw', + 'only_admin', + 'only_user', + 'only_guest', + 'allow_public', + 'status', + 'rank', + 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', + 'active', + 'canceled', + 'closed', + 'completed', + 'cron', + 'flagged', + 'internal', + 'locked', + 'pending', + 'planned', + 'problem', + 'retired', + 'suspended', + 'unknown', + 'label', + 'title', + 'byline', + 'slug', + 'url', + 'description', + 'introduction', + 'content', + 'summary', + 'icon', + 'image', + 'avatar', + 'ui', + 'assets', + 'meta', + 'notes', + 'options', + 'sources', + ]; +} diff --git a/tests/Feature/Http/Controllers/MilestoneTestCase.php b/tests/Feature/Http/Controllers/MilestoneTestCase.php index d32f9b3..0a094f0 100644 --- a/tests/Feature/Http/Controllers/MilestoneTestCase.php +++ b/tests/Feature/Http/Controllers/MilestoneTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Milestone', 'model_label_plural' => 'Milestones', 'model_route' => 'playground.matrix.resource.milestones', @@ -29,7 +49,7 @@ class MilestoneTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:milestone', 'table' => 'matrix_milestones', - 'view' => 'playground-matrix-resource::milestone', + 'view' => 'playground.matrix.resource::milestone', ]; /** @@ -46,6 +66,7 @@ class MilestoneTestCase extends TestCase 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'note_id', 'project_id', 'release_id', @@ -57,8 +78,8 @@ class MilestoneTestCase extends TestCase 'ticket_id', 'version_id', 'created_at', - 'deleted_at', 'updated_at', + 'deleted_at', 'start_at', 'planned_start_at', 'end_at', @@ -66,12 +87,10 @@ class MilestoneTestCase extends TestCase 'canceled_at', 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', 'published_at', 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -84,10 +103,22 @@ class MilestoneTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', 'completed', + 'cron', 'duplicate', 'fixed', 'flagged', @@ -120,6 +151,7 @@ class MilestoneTestCase extends TestCase 'board', 'flow', 'meta', + 'notes', 'options', 'roadmap', 'sources', diff --git a/tests/Feature/Http/Controllers/NoteTestCase.php b/tests/Feature/Http/Controllers/NoteTestCase.php index f9cdb05..656633f 100644 --- a/tests/Feature/Http/Controllers/NoteTestCase.php +++ b/tests/Feature/Http/Controllers/NoteTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Note', 'model_label_plural' => 'Notes', 'model_route' => 'playground.matrix.resource.notes', @@ -29,7 +49,7 @@ class NoteTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:note', 'table' => 'matrix_notes', - 'view' => 'playground-matrix-resource::note', + 'view' => 'playground.matrix.resource::note', ]; /** @@ -42,37 +62,11 @@ class NoteTestCase extends TestCase 'owned_by_id', 'parent_id', 'note_type', - // 'backlog_id', - // 'board_id', - // 'epic_id', - // 'flow_id', - // 'milestone_id', - // 'project_id', - // 'release_id', - // 'roadmap_id', - // 'source_id', - // 'sprint_id', - // 'tag_id', - // 'team_id', - // 'ticket_id', - // 'version_id', + 'matrix_id', + 'tag_id', 'created_at', - 'deleted_at', 'updated_at', - 'start_at', - 'planned_start_at', - 'end_at', - 'planned_end_at', - 'canceled_at', - 'closed_at', - 'embargo_at', - 'fixed_at', - 'postponed_at', - 'published_at', - 'released_at', - 'resumed_at', - 'resolved_at', - 'suspended_at', + 'deleted_at', 'gids', 'po', 'pg', @@ -84,23 +78,27 @@ class NoteTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', 'completed', - 'duplicate', - 'fixed', 'flagged', 'internal', 'locked', 'pending', 'planned', 'problem', - 'published', - 'released', - 'retired', - 'resolved', - 'suspended', 'unknown', 'label', 'title', @@ -116,12 +114,9 @@ class NoteTestCase extends TestCase 'avatar', 'ui', 'assets', - 'backlog', - 'board', - 'flow', 'meta', + 'notes', 'options', - 'roadmap', 'sources', ]; } diff --git a/tests/Feature/Http/Controllers/Playground/BacklogRouteTest.php b/tests/Feature/Http/Controllers/Playground/BacklogRouteTest.php index f2e4eb0..6fb402e 100644 --- a/tests/Feature/Http/Controllers/Playground/BacklogRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/BacklogRouteTest.php @@ -13,9 +13,9 @@ */ class BacklogRouteTest extends BacklogTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/BoardRouteTest.php b/tests/Feature/Http/Controllers/Playground/BoardRouteTest.php index 93669c3..4dd902f 100644 --- a/tests/Feature/Http/Controllers/Playground/BoardRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/BoardRouteTest.php @@ -13,9 +13,9 @@ */ class BoardRouteTest extends BoardTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/EpicRouteTest.php b/tests/Feature/Http/Controllers/Playground/EpicRouteTest.php index 22bdfc7..f4f1252 100644 --- a/tests/Feature/Http/Controllers/Playground/EpicRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/EpicRouteTest.php @@ -13,9 +13,9 @@ */ class EpicRouteTest extends EpicTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/FlowRouteTest.php b/tests/Feature/Http/Controllers/Playground/FlowRouteTest.php index aa0da32..22ff634 100644 --- a/tests/Feature/Http/Controllers/Playground/FlowRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/FlowRouteTest.php @@ -13,9 +13,9 @@ */ class FlowRouteTest extends FlowTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/IndexRouteTest.php b/tests/Feature/Http/Controllers/Playground/IndexRouteTest.php new file mode 100644 index 0000000..5e59cb0 --- /dev/null +++ b/tests/Feature/Http/Controllers/Playground/IndexRouteTest.php @@ -0,0 +1,47 @@ +get($url); + + $response->assertStatus(403); + } + + public function test_admin_can_render_index_view(): void + { + /** + * @var User $user + */ + $user = User::factory()->admin()->create(); + + $url = route('playground.matrix.resource'); + + $response = $this->actingAs($user)->get($url); + + $response->assertStatus(200); + + $this->assertAuthenticated(); + } +} diff --git a/tests/Feature/Http/Controllers/Playground/MilestoneRouteTest.php b/tests/Feature/Http/Controllers/Playground/MilestoneRouteTest.php index 1edd3c9..0ed0674 100644 --- a/tests/Feature/Http/Controllers/Playground/MilestoneRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/MilestoneRouteTest.php @@ -13,9 +13,9 @@ */ class MilestoneRouteTest extends MilestoneTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/NoteRouteTest.php b/tests/Feature/Http/Controllers/Playground/NoteRouteTest.php index 3c75d70..e5b800c 100644 --- a/tests/Feature/Http/Controllers/Playground/NoteRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/NoteRouteTest.php @@ -13,9 +13,9 @@ */ class NoteRouteTest extends NoteTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/ProjectRouteTest.php b/tests/Feature/Http/Controllers/Playground/ProjectRouteTest.php index dce5f38..96697ef 100644 --- a/tests/Feature/Http/Controllers/Playground/ProjectRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/ProjectRouteTest.php @@ -13,9 +13,9 @@ */ class ProjectRouteTest extends ProjectTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/ReleaseRouteTest.php b/tests/Feature/Http/Controllers/Playground/ReleaseRouteTest.php index 694bb60..7a057cc 100644 --- a/tests/Feature/Http/Controllers/Playground/ReleaseRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/ReleaseRouteTest.php @@ -13,9 +13,9 @@ */ class ReleaseRouteTest extends ReleaseTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/RoadmapRouteTest.php b/tests/Feature/Http/Controllers/Playground/RoadmapRouteTest.php index 108355c..b101677 100644 --- a/tests/Feature/Http/Controllers/Playground/RoadmapRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/RoadmapRouteTest.php @@ -13,9 +13,9 @@ */ class RoadmapRouteTest extends RoadmapTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/SourceRouteTest.php b/tests/Feature/Http/Controllers/Playground/SourceRouteTest.php index fb7d8e2..9813452 100644 --- a/tests/Feature/Http/Controllers/Playground/SourceRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/SourceRouteTest.php @@ -13,9 +13,9 @@ */ class SourceRouteTest extends SourceTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/SprintRouteTest.php b/tests/Feature/Http/Controllers/Playground/SprintRouteTest.php index e54d7e6..c4f6da4 100644 --- a/tests/Feature/Http/Controllers/Playground/SprintRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/SprintRouteTest.php @@ -13,9 +13,9 @@ */ class SprintRouteTest extends SprintTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/TagRouteTest.php b/tests/Feature/Http/Controllers/Playground/TagRouteTest.php index 3e510bc..cbc316e 100644 --- a/tests/Feature/Http/Controllers/Playground/TagRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/TagRouteTest.php @@ -13,9 +13,9 @@ */ class TagRouteTest extends TagTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/TeamRouteTest.php b/tests/Feature/Http/Controllers/Playground/TeamRouteTest.php index 0dcb479..eb8cc7a 100644 --- a/tests/Feature/Http/Controllers/Playground/TeamRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/TeamRouteTest.php @@ -13,9 +13,9 @@ */ class TeamRouteTest extends TeamTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/Playground/TestTrait.php b/tests/Feature/Http/Controllers/Playground/TestTrait.php deleted file mode 100644 index eed54b5..0000000 --- a/tests/Feature/Http/Controllers/Playground/TestTrait.php +++ /dev/null @@ -1,66 +0,0 @@ -set('auth.providers.users.model', '\\Playground\\Models\\Playground'); - - $app['config']->set('playground-matrix.load.migrations', true); - - $app['config']->set('app.debug', true); - $app['config']->set('playground-auth.debug', true); - - $app['config']->set('playground-auth.verify', 'roles'); - $app['config']->set('auth.testing.password', 'password'); - $app['config']->set('auth.testing.hashed', false); - // $app['config']->set('playground-auth.verify', 'privileges'); - $app['config']->set('playground-auth.sanctum', false); - $app['config']->set('playground-auth.hasPrivilege', true); - $app['config']->set('playground-auth.userPrivileges', true); - $app['config']->set('playground-auth.hasRole', true); - $app['config']->set('playground-auth.userRole', true); - $app['config']->set('playground-auth.userRoles', true); - - // $app['config']->set('playground-auth.token.roles', true); - // $app['config']->set('playground-auth.token.sanctum', true); - - // $middleware = []; - // api,auth:sanctum,web - - // $app['config']->set('playground-matrix-resource.routes.matrix', true); - // $app['config']->set('playground-matrix-resource.routes.backlogs', true); - // $app['config']->set('playground-matrix-resource.routes.boards', true); - // $app['config']->set('playground-matrix-resource.routes.epics', true); - // $app['config']->set('playground-matrix-resource.routes.flows', true); - // $app['config']->set('playground-matrix-resource.routes.milestones', true); - // $app['config']->set('playground-matrix-resource.routes.notes', true); - // $app['config']->set('playground-matrix-resource.routes.projects', true); - // $app['config']->set('playground-matrix-resource.routes.releases', true); - // $app['config']->set('playground-matrix-resource.routes.roadmaps', true); - // $app['config']->set('playground-matrix-resource.routes.sources', true); - // $app['config']->set('playground-matrix-resource.routes.sprints', true); - // $app['config']->set('playground-matrix-resource.routes.tags', true); - // $app['config']->set('playground-matrix-resource.routes.teams', true); - // $app['config']->set('playground-matrix-resource.routes.tickets', true); - // $app['config']->set('playground-matrix-resource.routes.versions', true); - - // $app['config']->set('playground-matrix-resource.sitemap.enable', true); - // $app['config']->set('playground-matrix-resource.sitemap.guest', true); - // $app['config']->set('playground-matrix-resource.sitemap.user', true); - } -} diff --git a/tests/Feature/Http/Controllers/Playground/TicketRouteTest.php b/tests/Feature/Http/Controllers/Playground/TicketRouteTest.php index 2af31b3..670aa43 100644 --- a/tests/Feature/Http/Controllers/Playground/TicketRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/TicketRouteTest.php @@ -6,6 +6,9 @@ */ namespace Tests\Feature\Playground\Matrix\Resource\Http\Controllers\Playground; +use Playground\Matrix\Models\Project; +use Playground\Matrix\Models\Ticket; +use Playground\Test\Models\PlaygroundUser as User; use Tests\Feature\Playground\Matrix\Resource\Http\Controllers\TicketTestCase; /** @@ -13,9 +16,153 @@ */ class TicketRouteTest extends TicketTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; + + public function test_admin_can_create_ticket_with_project(): void + { + /** + * @var Project $project + */ + $project = Project::factory()->create([ + 'key' => 'testing', + ]); + + /** + * @var Ticket $ticket + */ + $ticket = Ticket::factory()->make([ + 'project_id' => $project->id, + 'priority' => 'fire', + 'resolution' => 'unresolved', + 'severity' => 'medium', + 'step' => '', + 'handler' => 'handler', + 'state' => 'state', + 'workflow_type' => 'workflow_type', + 'actual' => 'actual', + 'expected' => 'expected', + 'steps' => 'steps', + 'story' => 'story', + 'criteria' => 'Important criteria', + ]); + + /** + * @var User $user + */ + $user = User::factory()->admin()->create(); + + $url = route('playground.matrix.resource.tickets.post'); + + $data = $ticket->toArray(); + + // dump([ + // '__METHOD__' => __METHOD__, + // 'project' => $project->toArray(), + // 'ticket' => $ticket->toArray(), + // // 'user' => $user->toArray(), + // '$url' => $url, + // ]); + + $response = $this->actingAs($user)->postJson($url, $data); + + // $response->dump(); + $response->assertStatus(201); + + $response->assertJsonPath('data.project_id', $ticket->project_id); + $response->assertJsonPath('data.project_id', $project->id); + $response->assertJsonPath('data.handler', 'handler'); + $response->assertJsonPath('data.priority', 'fire'); + $response->assertJsonPath('data.resolution', 'unresolved'); + $response->assertJsonPath('data.severity', 'medium'); + $response->assertJsonPath('data.step', ''); + $response->assertJsonPath('data.state', 'state'); + $response->assertJsonPath('data.workflow_type', 'workflow_type'); + $response->assertJsonPath('data.actual', 'actual'); + $response->assertJsonPath('data.expected', 'expected'); + $response->assertJsonPath('data.steps', 'steps'); + $response->assertJsonPath('data.story', 'story'); + $response->assertJsonPath('data.criteria', 'Important criteria'); + + $this->assertAuthenticated(); + } + + public function test_admin_can_update_ticket_with_project(): void + { + /** + * @var Project $project + */ + $project = Project::factory()->create([ + 'key' => 'testing', + ]); + + /** + * @var Ticket $ticket + */ + $ticket = Ticket::factory()->create([ + 'project_id' => $project->id, + ]); + + /** + * @var Ticket $ticket + */ + $ticket_update = Ticket::factory()->make([ + 'project_id' => $project->id, + 'priority' => 'fire', + 'resolution' => 'unresolved', + 'severity' => 'medium', + 'step' => '', + 'handler' => 'handler', + 'state' => 'state', + 'workflow_type' => 'workflow_type', + 'actual' => 'actual', + 'expected' => 'expected', + 'steps' => 'steps', + 'story' => 'story', + 'criteria' => 'Important criteria', + ]); + + /** + * @var User $user + */ + $user = User::factory()->admin()->create(); + + $url = route('playground.matrix.resource.tickets.patch', $ticket); + + $data = $ticket_update->toArray(); + + // dump([ + // '__METHOD__' => __METHOD__, + // 'project' => $project->toArray(), + // 'ticket' => $ticket->toArray(), + // // 'user' => $user->toArray(), + // '$url' => $url, + // ]); + + $response = $this->actingAs($user)->patchJson($url, $data); + + // $response->dump(); + $response->assertStatus(200); + + $response->assertJsonPath('data.project_id', $ticket->project_id); + $response->assertJsonPath('data.project_id', $project->id); + $response->assertJsonPath('data.project_id', $ticket_update->project_id); + $response->assertJsonPath('data.handler', 'handler'); + $response->assertJsonPath('data.priority', 'fire'); + $response->assertJsonPath('data.resolution', 'unresolved'); + $response->assertJsonPath('data.severity', 'medium'); + $response->assertJsonPath('data.step', ''); + $response->assertJsonPath('data.state', 'state'); + $response->assertJsonPath('data.workflow_type', 'workflow_type'); + $response->assertJsonPath('data.actual', 'actual'); + $response->assertJsonPath('data.expected', 'expected'); + $response->assertJsonPath('data.steps', 'steps'); + $response->assertJsonPath('data.story', 'story'); + $response->assertJsonPath('data.criteria', 'Important criteria'); + + $this->assertAuthenticated(); + } } diff --git a/tests/Feature/Http/Controllers/Playground/VersionRouteTest.php b/tests/Feature/Http/Controllers/Playground/VersionRouteTest.php index 5b182c7..a0dbc6b 100644 --- a/tests/Feature/Http/Controllers/Playground/VersionRouteTest.php +++ b/tests/Feature/Http/Controllers/Playground/VersionRouteTest.php @@ -13,9 +13,9 @@ */ class VersionRouteTest extends VersionTestCase { - use TestTrait; + protected bool $load_migrations_package = true; protected bool $load_migrations_playground = true; - protected bool $load_migrations_matrix = true; + protected bool $setUpUserForPlayground = true; } diff --git a/tests/Feature/Http/Controllers/ProjectTestCase.php b/tests/Feature/Http/Controllers/ProjectTestCase.php index 5ae5d2c..adca857 100644 --- a/tests/Feature/Http/Controllers/ProjectTestCase.php +++ b/tests/Feature/Http/Controllers/ProjectTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Project', 'model_label_plural' => 'Projects', 'model_route' => 'playground.matrix.resource.projects', @@ -29,7 +49,7 @@ class ProjectTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:project', 'table' => 'matrix_projects', - 'view' => 'playground-matrix-resource::project', + 'view' => 'playground.matrix.resource::project', ]; /** @@ -46,6 +66,7 @@ class ProjectTestCase extends TestCase 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'release_id', @@ -57,8 +78,8 @@ class ProjectTestCase extends TestCase 'ticket_id', 'version_id', 'created_at', - 'deleted_at', 'updated_at', + 'deleted_at', 'start_at', 'planned_start_at', 'end_at', @@ -66,12 +87,10 @@ class ProjectTestCase extends TestCase 'canceled_at', 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', 'published_at', 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -84,22 +103,29 @@ class ProjectTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', 'completed', - 'duplicate', - 'fixed', + 'cron', 'flagged', 'internal', 'locked', 'pending', 'planned', 'problem', - 'published', 'released', - 'retired', - 'resolved', 'suspended', 'unknown', 'label', @@ -111,6 +137,8 @@ class ProjectTestCase extends TestCase 'introduction', 'content', 'summary', + 'key', + 'code_name', 'icon', 'image', 'avatar', @@ -119,7 +147,9 @@ class ProjectTestCase extends TestCase 'backlog', 'board', 'flow', + 'history', 'meta', + 'notes', 'options', 'roadmap', 'sources', diff --git a/tests/Feature/Http/Controllers/ReleaseTestCase.php b/tests/Feature/Http/Controllers/ReleaseTestCase.php index 31eee1c..09a8f70 100644 --- a/tests/Feature/Http/Controllers/ReleaseTestCase.php +++ b/tests/Feature/Http/Controllers/ReleaseTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Release', 'model_label_plural' => 'Releases', 'model_route' => 'playground.matrix.resource.releases', @@ -29,7 +49,7 @@ class ReleaseTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:release', 'table' => 'matrix_releases', - 'view' => 'playground-matrix-resource::release', + 'view' => 'playground.matrix.resource::release', ]; /** @@ -46,6 +66,7 @@ class ReleaseTestCase extends TestCase 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -57,8 +78,8 @@ class ReleaseTestCase extends TestCase 'ticket_id', 'version_id', 'created_at', - 'deleted_at', 'updated_at', + 'deleted_at', 'start_at', 'planned_start_at', 'end_at', @@ -66,12 +87,10 @@ class ReleaseTestCase extends TestCase 'canceled_at', 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', 'published_at', 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -84,12 +103,22 @@ class ReleaseTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', 'completed', - 'duplicate', - 'fixed', + 'cron', 'flagged', 'internal', 'locked', @@ -98,8 +127,6 @@ class ReleaseTestCase extends TestCase 'problem', 'published', 'released', - 'retired', - 'resolved', 'suspended', 'unknown', 'label', @@ -120,6 +147,7 @@ class ReleaseTestCase extends TestCase 'board', 'flow', 'meta', + 'notes', 'options', 'roadmap', 'sources', diff --git a/tests/Feature/Http/Controllers/RoadmapTestCase.php b/tests/Feature/Http/Controllers/RoadmapTestCase.php index 7a69890..d926771 100644 --- a/tests/Feature/Http/Controllers/RoadmapTestCase.php +++ b/tests/Feature/Http/Controllers/RoadmapTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Roadmap', 'model_label_plural' => 'Roadmaps', 'model_route' => 'playground.matrix.resource.roadmaps', @@ -29,7 +49,7 @@ class RoadmapTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:roadmap', 'table' => 'matrix_roadmaps', - 'view' => 'playground-matrix-resource::roadmap', + 'view' => 'playground.matrix.resource::roadmap', ]; /** @@ -46,6 +66,7 @@ class RoadmapTestCase extends TestCase 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -57,8 +78,8 @@ class RoadmapTestCase extends TestCase 'ticket_id', 'version_id', 'created_at', - 'deleted_at', 'updated_at', + 'deleted_at', 'start_at', 'planned_start_at', 'end_at', @@ -66,12 +87,10 @@ class RoadmapTestCase extends TestCase 'canceled_at', 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', 'published_at', 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -84,12 +103,22 @@ class RoadmapTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', 'completed', - 'duplicate', - 'fixed', + 'cron', 'flagged', 'internal', 'locked', @@ -98,8 +127,6 @@ class RoadmapTestCase extends TestCase 'problem', 'published', 'released', - 'retired', - 'resolved', 'suspended', 'unknown', 'label', @@ -120,6 +147,7 @@ class RoadmapTestCase extends TestCase 'board', 'flow', 'meta', + 'notes', 'options', 'roadmap', 'sources', diff --git a/tests/Feature/Http/Controllers/SourceTestCase.php b/tests/Feature/Http/Controllers/SourceTestCase.php index 4a55b42..0f8f6f0 100644 --- a/tests/Feature/Http/Controllers/SourceTestCase.php +++ b/tests/Feature/Http/Controllers/SourceTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Source', 'model_label_plural' => 'Sources', 'model_route' => 'playground.matrix.resource.sources', @@ -29,7 +49,7 @@ class SourceTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:source', 'table' => 'matrix_sources', - 'view' => 'playground-matrix-resource::source', + 'view' => 'playground.matrix.resource::source', ]; /** @@ -42,23 +62,12 @@ class SourceTestCase extends TestCase 'owned_by_id', 'parent_id', 'source_type', - 'backlog_id', - 'board_id', - 'epic_id', - 'flow_id', - 'milestone_id', - 'note_id', - 'project_id', - 'release_id', - 'roadmap_id', - 'sprint_id', + 'matrix_id', 'tag_id', 'team_id', - 'ticket_id', - 'version_id', 'created_at', - 'deleted_at', 'updated_at', + 'deleted_at', 'start_at', 'planned_start_at', 'end_at', @@ -66,12 +75,10 @@ class SourceTestCase extends TestCase 'canceled_at', 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', 'published_at', 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -84,12 +91,22 @@ class SourceTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', 'completed', - 'duplicate', - 'fixed', + 'cron', 'flagged', 'internal', 'locked', @@ -98,8 +115,6 @@ class SourceTestCase extends TestCase 'problem', 'published', 'released', - 'retired', - 'resolved', 'suspended', 'unknown', 'label', @@ -116,12 +131,9 @@ class SourceTestCase extends TestCase 'avatar', 'ui', 'assets', - 'backlog', - 'board', - 'flow', 'meta', + 'notes', 'options', - 'roadmap', 'sources', ]; } diff --git a/tests/Feature/Http/Controllers/SprintTestCase.php b/tests/Feature/Http/Controllers/SprintTestCase.php index 2d5bad6..60b31d8 100644 --- a/tests/Feature/Http/Controllers/SprintTestCase.php +++ b/tests/Feature/Http/Controllers/SprintTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Sprint', 'model_label_plural' => 'Sprints', 'model_route' => 'playground.matrix.resource.sprints', @@ -29,7 +49,7 @@ class SprintTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:sprint', 'table' => 'matrix_sprints', - 'view' => 'playground-matrix-resource::sprint', + 'view' => 'playground.matrix.resource::sprint', ]; /** @@ -46,6 +66,7 @@ class SprintTestCase extends TestCase 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -57,8 +78,8 @@ class SprintTestCase extends TestCase 'ticket_id', 'version_id', 'created_at', - 'deleted_at', 'updated_at', + 'deleted_at', 'start_at', 'planned_start_at', 'end_at', @@ -84,10 +105,22 @@ class SprintTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', 'completed', + 'cron', 'duplicate', 'fixed', 'flagged', @@ -120,6 +153,7 @@ class SprintTestCase extends TestCase 'board', 'flow', 'meta', + 'notes', 'options', 'roadmap', 'sources', diff --git a/tests/Feature/Http/Controllers/TagTestCase.php b/tests/Feature/Http/Controllers/TagTestCase.php index 7206d03..c9ccfd5 100644 --- a/tests/Feature/Http/Controllers/TagTestCase.php +++ b/tests/Feature/Http/Controllers/TagTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Tag', 'model_label_plural' => 'Tags', 'model_route' => 'playground.matrix.resource.tags', @@ -29,7 +49,7 @@ class TagTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:tag', 'table' => 'matrix_tags', - 'view' => 'playground-matrix-resource::tag', + 'view' => 'playground.matrix.resource::tag', ]; /** @@ -42,37 +62,10 @@ class TagTestCase extends TestCase 'owned_by_id', 'parent_id', 'tag_type', - 'backlog_id', - 'board_id', - 'epic_id', - 'flow_id', - 'milestone_id', - 'note_id', - 'project_id', - 'release_id', - 'roadmap_id', - 'source_id', - 'sprint_id', - 'team_id', - 'ticket_id', - 'version_id', + 'matrix_id', 'created_at', - 'deleted_at', 'updated_at', - 'start_at', - 'planned_start_at', - 'end_at', - 'planned_end_at', - 'canceled_at', - 'closed_at', - 'embargo_at', - 'fixed_at', - 'postponed_at', - 'published_at', - 'released_at', - 'resumed_at', - 'resolved_at', - 'suspended_at', + 'deleted_at', 'gids', 'po', 'pg', @@ -84,23 +77,22 @@ class TagTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', - 'canceled', - 'closed', - 'completed', - 'duplicate', - 'fixed', 'flagged', 'internal', 'locked', - 'pending', - 'planned', - 'problem', - 'published', - 'released', 'retired', - 'resolved', - 'suspended', 'unknown', 'label', 'title', @@ -116,12 +108,9 @@ class TagTestCase extends TestCase 'avatar', 'ui', 'assets', - 'backlog', - 'board', - 'flow', 'meta', + 'notes', 'options', - 'roadmap', 'sources', ]; } diff --git a/tests/Feature/Http/Controllers/TeamTestCase.php b/tests/Feature/Http/Controllers/TeamTestCase.php index 8b2552e..f2be454 100644 --- a/tests/Feature/Http/Controllers/TeamTestCase.php +++ b/tests/Feature/Http/Controllers/TeamTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Team', 'model_label_plural' => 'Teams', 'model_route' => 'playground.matrix.resource.teams', @@ -29,7 +49,7 @@ class TeamTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:team', 'table' => 'matrix_teams', - 'view' => 'playground-matrix-resource::team', + 'view' => 'playground.matrix.resource::team', ]; /** @@ -46,6 +66,7 @@ class TeamTestCase extends TestCase 'board_id', 'epic_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', @@ -57,8 +78,8 @@ class TeamTestCase extends TestCase 'ticket_id', 'version_id', 'created_at', - 'deleted_at', 'updated_at', + 'deleted_at', 'start_at', 'planned_start_at', 'end_at', @@ -66,12 +87,8 @@ class TeamTestCase extends TestCase 'canceled_at', 'closed_at', 'embargo_at', - 'fixed_at', 'postponed_at', - 'published_at', - 'released_at', 'resumed_at', - 'resolved_at', 'suspended_at', 'gids', 'po', @@ -84,22 +101,29 @@ class TeamTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', 'completed', - 'duplicate', - 'fixed', + 'cron', 'flagged', 'internal', 'locked', 'pending', 'planned', 'problem', - 'published', - 'released', 'retired', - 'resolved', 'suspended', 'unknown', 'label', @@ -120,6 +144,7 @@ class TeamTestCase extends TestCase 'board', 'flow', 'meta', + 'notes', 'options', 'roadmap', 'sources', diff --git a/tests/Feature/Http/Controllers/TestCase.php b/tests/Feature/Http/Controllers/TestCase.php index 619a537..6c58813 100644 --- a/tests/Feature/Http/Controllers/TestCase.php +++ b/tests/Feature/Http/Controllers/TestCase.php @@ -1,9 +1,9 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => '', 'model_label_plural' => '', 'model_route' => '', @@ -46,9 +50,9 @@ class TestCase extends BaseTestCase 'module_label_plural' => 'Matrices', 'module_route' => 'playground.matrix.resource', 'module_slug' => 'matrix', - 'privilege' => '', + 'privilege' => 'playground-matrix-resource:', 'table' => '', - 'view' => '', + 'view' => 'playground.matrix.resource::', ]; /** diff --git a/tests/Feature/Http/Controllers/TicketTestCase.php b/tests/Feature/Http/Controllers/TicketTestCase.php index e264ae4..c66fa75 100644 --- a/tests/Feature/Http/Controllers/TicketTestCase.php +++ b/tests/Feature/Http/Controllers/TicketTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Ticket', 'model_label_plural' => 'Tickets', 'model_route' => 'playground.matrix.resource.tickets', @@ -29,7 +49,7 @@ class TicketTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:ticket', 'table' => 'matrix_tickets', - 'view' => 'playground-matrix-resource::ticket', + 'view' => 'playground.matrix.resource::ticket', ]; /** @@ -44,21 +64,27 @@ class TicketTestCase extends TestCase 'ticket_type', 'backlog_id', 'board_id', + 'completed_by_id', + 'duplicate_id', 'epic_id', + 'fixed_by_id', 'flow_id', + 'matrix_id', 'milestone_id', 'note_id', 'project_id', 'release_id', + 'reported_by_id', 'roadmap_id', 'source_id', 'sprint_id', 'tag_id', 'team_id', + 'version_fixed_id', 'version_id', 'created_at', - 'deleted_at', 'updated_at', + 'deleted_at', 'start_at', 'planned_start_at', 'end_at', @@ -84,10 +110,22 @@ class TicketTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', 'canceled', 'closed', 'completed', + 'cron', 'duplicate', 'fixed', 'flagged', @@ -95,6 +133,7 @@ class TicketTestCase extends TestCase 'locked', 'pending', 'planned', + 'prioritized', 'problem', 'published', 'released', @@ -111,6 +150,23 @@ class TicketTestCase extends TestCase 'introduction', 'content', 'summary', + 'handler', + 'key', + 'code', + 'key_code_hash', + 'priority', + 'severity', + 'resolution', + 'step', + 'state', + 'workflow_type', + 'points', + 'actual', + 'expected', + 'story', + 'steps', + 'criteria', + 'reproducibility', 'icon', 'image', 'avatar', @@ -119,7 +175,9 @@ class TicketTestCase extends TestCase 'backlog', 'board', 'flow', + 'history', 'meta', + 'notes', 'options', 'roadmap', 'sources', diff --git a/tests/Feature/Http/Controllers/VersionTestCase.php b/tests/Feature/Http/Controllers/VersionTestCase.php index 2cbf0a9..4d14243 100644 --- a/tests/Feature/Http/Controllers/VersionTestCase.php +++ b/tests/Feature/Http/Controllers/VersionTestCase.php @@ -1,14 +1,34 @@ */ public array $packageInfo = [ - 'model_attribute' => 'label', + 'model_attribute' => 'title', 'model_label' => 'Version', 'model_label_plural' => 'Versions', 'model_route' => 'playground.matrix.resource.versions', @@ -29,7 +49,7 @@ class VersionTestCase extends TestCase 'module_slug' => 'matrix', 'privilege' => 'playground-matrix-resource:version', 'table' => 'matrix_versions', - 'view' => 'playground-matrix-resource::version', + 'view' => 'playground.matrix.resource::version', ]; /** @@ -42,37 +62,10 @@ class VersionTestCase extends TestCase 'owned_by_id', 'parent_id', 'version_type', - 'backlog_id', - 'board_id', - 'epic_id', - 'flow_id', - 'milestone_id', - 'note_id', - 'project_id', - 'release_id', - 'roadmap_id', - 'source_id', - 'sprint_id', - 'tag_id', - 'team_id', - 'ticket_id', + 'matrix_id', 'created_at', - 'deleted_at', 'updated_at', - 'start_at', - 'planned_start_at', - 'end_at', - 'planned_end_at', - 'canceled_at', - 'closed_at', - 'embargo_at', - 'fixed_at', - 'postponed_at', - 'published_at', - 'released_at', - 'resumed_at', - 'resolved_at', - 'suspended_at', + 'deleted_at', 'gids', 'po', 'pg', @@ -84,23 +77,22 @@ class VersionTestCase extends TestCase 'status', 'rank', 'size', + 'matrix', + 'x', + 'y', + 'z', + 'r', + 'theta', + 'rho', + 'phi', + 'elevation', + 'latitude', + 'longitude', 'active', - 'canceled', - 'closed', - 'completed', - 'duplicate', - 'fixed', 'flagged', 'internal', 'locked', - 'pending', - 'planned', - 'problem', - 'published', - 'released', 'retired', - 'resolved', - 'suspended', 'unknown', 'label', 'title', @@ -116,12 +108,9 @@ class VersionTestCase extends TestCase 'avatar', 'ui', 'assets', - 'backlog', - 'board', - 'flow', 'meta', + 'notes', 'options', - 'roadmap', 'sources', ]; } diff --git a/tests/Feature/TestCase.php b/tests/Feature/TestCase.php index 8682c25..1d51ac4 100644 --- a/tests/Feature/TestCase.php +++ b/tests/Feature/TestCase.php @@ -1,15 +1,14 @@ __METHOD__, + // 'env(TEST_DB_MIGRATIONS)' => env('TEST_DB_MIGRATIONS'), + // '$this->load_migrations_laravel' => $this->load_migrations_laravel, + // '$this->load_migrations_package' => $this->load_migrations_package, + // '$this->load_migrations_laravel' => $this->load_migrations_playground, + // 'database/migrations-laravel' => dirname(dirname(__DIR__)).'/database/migrations-laravel', + // 'database/migrations-package' => dirname(dirname(__DIR__)).'/database/migrations-package', + // 'database/migrations-playground' => dirname(dirname(__DIR__)).'/database/migrations-playground', + // ]); if (! empty(env('TEST_DB_MIGRATIONS'))) { - // $this->loadLaravelMigrations(); + if ($this->load_migrations_laravel) { + $this->loadMigrationsFrom(dirname(dirname(__DIR__)).'/database/migrations-laravel'); + } + if ($this->load_migrations_package) { + $this->loadMigrationsFrom(dirname(dirname(__DIR__)).'/database/migrations-package'); + } if ($this->load_migrations_playground) { $this->loadMigrationsFrom(dirname(dirname(__DIR__)).'/database/migrations-playground'); } - if ($this->load_migrations_matrix) { - $this->loadMigrationsFrom(dirname(dirname(__DIR__)).'/database/migrations-matrix-uuid'); - } } } - - /** - * Set up the environment. - * - * @param \Illuminate\Foundation\Application $app - */ - protected function getEnvironmentSetUp($app) - { - $app['config']->set('auth.providers.users.model', 'Playground\\Test\\Models\\User'); - $app['config']->set('playground-auth.verify', 'user'); - $app['config']->set('auth.testing.password', 'password'); - $app['config']->set('auth.testing.hashed', false); - - $app['config']->set('playground-cms.load.migrations', true); - } } diff --git a/tests/Unit/Http/Requests/Backlog/CreateRequestTest.php b/tests/Unit/Http/Requests/Backlog/CreateRequestTest.php index 52b40c1..19fdc61 100644 --- a/tests/Unit/Http/Requests/Backlog/CreateRequestTest.php +++ b/tests/Unit/Http/Requests/Backlog/CreateRequestTest.php @@ -1,17 +1,20 @@ assertInstanceOf(BacklogPolicy::class, $instance); } - - // public function test_dump_console_about(): void - // { - // $result = $this->withoutMockingConsoleOutput()->artisan('about'); - // dump(Artisan::output()); - // } } diff --git a/tests/Unit/Policies/BoardPolicy/PolicyTest.php b/tests/Unit/Policies/BoardPolicy/PolicyTest.php new file mode 100644 index 0000000..9861588 --- /dev/null +++ b/tests/Unit/Policies/BoardPolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(BoardPolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/EpicPolicy/PolicyTest.php b/tests/Unit/Policies/EpicPolicy/PolicyTest.php new file mode 100644 index 0000000..da474e9 --- /dev/null +++ b/tests/Unit/Policies/EpicPolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(EpicPolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/FlowPolicy/PolicyTest.php b/tests/Unit/Policies/FlowPolicy/PolicyTest.php new file mode 100644 index 0000000..ef889e6 --- /dev/null +++ b/tests/Unit/Policies/FlowPolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(FlowPolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/MatrixPolicy/PolicyTest.php b/tests/Unit/Policies/MatrixPolicy/PolicyTest.php new file mode 100644 index 0000000..6c2a36d --- /dev/null +++ b/tests/Unit/Policies/MatrixPolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(MatrixPolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/MilestonePolicy/PolicyTest.php b/tests/Unit/Policies/MilestonePolicy/PolicyTest.php new file mode 100644 index 0000000..4f73b1a --- /dev/null +++ b/tests/Unit/Policies/MilestonePolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(MilestonePolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/NotePolicy/PolicyTest.php b/tests/Unit/Policies/NotePolicy/PolicyTest.php new file mode 100644 index 0000000..67a1147 --- /dev/null +++ b/tests/Unit/Policies/NotePolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(NotePolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/ProjectPolicy/PolicyTest.php b/tests/Unit/Policies/ProjectPolicy/PolicyTest.php new file mode 100644 index 0000000..46f1471 --- /dev/null +++ b/tests/Unit/Policies/ProjectPolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(ProjectPolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/ReleasePolicy/PolicyTest.php b/tests/Unit/Policies/ReleasePolicy/PolicyTest.php new file mode 100644 index 0000000..e048764 --- /dev/null +++ b/tests/Unit/Policies/ReleasePolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(ReleasePolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/RoadmapPolicy/PolicyTest.php b/tests/Unit/Policies/RoadmapPolicy/PolicyTest.php new file mode 100644 index 0000000..a5afeb1 --- /dev/null +++ b/tests/Unit/Policies/RoadmapPolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(RoadmapPolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/SourcePolicy/PolicyTest.php b/tests/Unit/Policies/SourcePolicy/PolicyTest.php new file mode 100644 index 0000000..58d431c --- /dev/null +++ b/tests/Unit/Policies/SourcePolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(SourcePolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/SprintPolicy/PolicyTest.php b/tests/Unit/Policies/SprintPolicy/PolicyTest.php new file mode 100644 index 0000000..35e2a52 --- /dev/null +++ b/tests/Unit/Policies/SprintPolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(SprintPolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/TagPolicy/PolicyTest.php b/tests/Unit/Policies/TagPolicy/PolicyTest.php new file mode 100644 index 0000000..79d11c4 --- /dev/null +++ b/tests/Unit/Policies/TagPolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(TagPolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/TeamPolicy/PolicyTest.php b/tests/Unit/Policies/TeamPolicy/PolicyTest.php new file mode 100644 index 0000000..9b2aab7 --- /dev/null +++ b/tests/Unit/Policies/TeamPolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(TeamPolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/TicketPolicy/PolicyTest.php b/tests/Unit/Policies/TicketPolicy/PolicyTest.php new file mode 100644 index 0000000..e359a62 --- /dev/null +++ b/tests/Unit/Policies/TicketPolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(TicketPolicy::class, $instance); + } +} diff --git a/tests/Unit/Policies/VersionPolicy/PolicyTest.php b/tests/Unit/Policies/VersionPolicy/PolicyTest.php new file mode 100644 index 0000000..929dc8a --- /dev/null +++ b/tests/Unit/Policies/VersionPolicy/PolicyTest.php @@ -0,0 +1,25 @@ +assertInstanceOf(VersionPolicy::class, $instance); + } +} diff --git a/tests/Unit/ServiceProvider/InstanceTest.php b/tests/Unit/ServiceProvider/InstanceTest.php new file mode 100644 index 0000000..30e60b0 --- /dev/null +++ b/tests/Unit/ServiceProvider/InstanceTest.php @@ -0,0 +1,102 @@ +newInstanceWithoutConstructor(); + + $this->assertNotEmpty(ServiceProvider::VERSION); + $this->assertIsString(ServiceProvider::VERSION); + $this->assertSame(ServiceProvider::VERSION, $instance->version()); + } + + public function test_setPolicies_with_empty_array(): void + { + $instance = (new \ReflectionClass(ServiceProvider::class))->newInstanceWithoutConstructor(); + + $policies = []; + + $instance->setPolicies($policies); + + $this->assertSame( + $policies, + $instance->policies() + ); + } + + public function test_setPolicies_with_invalid_model(): void + { + $log = LogFake::bind(); + + $instance = (new \ReflectionClass(ServiceProvider::class))->newInstanceWithoutConstructor(); + + /** + * @var array $policies + */ + $policies = [ + '\\Some\\InvalidModelClass' => '\\Some\\InvalidPolicyClass', + ]; + + $instance->setPolicies($policies); + + // $log->dump(); + + $log->assertLogged( + fn (LogEntry $log) => $log->level === 'error' + ); + + $log->assertLogged( + fn (LogEntry $log) => is_string($log->message) && str_contains( + $log->message, + 'Expecting the model to exist for the policy.' + ) + ); + } + + public function test_setPolicies_with_invalid_policy(): void + { + $log = LogFake::bind(); + + $instance = (new \ReflectionClass(ServiceProvider::class))->newInstanceWithoutConstructor(); + + /** + * @var array $policies + */ + $policies = [ + Model::class => '\\Some\\InvalidPolicyClass', + ]; + + $instance->setPolicies($policies); + + // $log->dump(); + + $log->assertLogged( + fn (LogEntry $log) => $log->level === 'error' + ); + + $log->assertLogged( + fn (LogEntry $log) => is_string($log->message) && str_contains( + $log->message, + 'Expecting the policy to exist for the model.' + ) + ); + } +} diff --git a/tests/Unit/TestCase.php b/tests/Unit/TestCase.php index 3e54e4f..19c25c3 100644 --- a/tests/Unit/TestCase.php +++ b/tests/Unit/TestCase.php @@ -1,9 +1,9 @@ set('auth.providers.users.model', 'Playground\\Test\\Models\\User'); - $app['config']->set('playground-auth.verify', 'user'); - $app['config']->set('auth.testing.password', 'password'); - $app['config']->set('auth.testing.hashed', false); - - $app['config']->set('playground-cms.load.migrations', true); - } -}