diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b75e48f..99ab54f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,12 @@ on: push: branches: [ "develop" ] pull_request: - branches: [ "develop" ] + types: + - opened + - reopened + - synchronize + - ready_for_review + - review_requested permissions: contents: write @@ -16,10 +21,74 @@ jobs: build: runs-on: ubuntu-latest - + if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} steps: - - uses: actions/checkout@v3 - # - uses: php-actions/composer@v6 + - name: Preparing timer + id: timer_start + run: | + echo "DATE_START=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT + echo "TIMESTAMP_START=$(date +'%s')" >> $GITHUB_OUTPUT + - name: "Slack notification: IN PROGRESS" + id: slack + uses: slackapi/slack-github-action@v1.24.0 + with: + 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 }}", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": ":runner: CI Build Status for playground-matrix-resource" + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}" + }, + { + "type": "mrkdwn", + "text": "*End:*\n--" + } + ] + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Status:* IN PROGRESS" + }, + { + "type": "mrkdwn", + "text": ":timer_clock: --" + } + ] + }, + { + "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 }}" + } + } + ] + } + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + - uses: actions/checkout@v4 - name: Run php-actions/composer@v6 uses: php-actions/composer@v6 with: @@ -30,7 +99,9 @@ jobs: env: XDEBUG_MODE: coverage with: - php_extensions: xdebug + version: "10.1" + php_version: "8.2" + php_extensions: intl xdebug coverage_clover: clover.xml coverage_text: true - name: Make code coverage badge @@ -46,3 +117,138 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} user_name: 'github-actions[bot]' user_email: 'github-actions[bot]@users.noreply.github.com' + - uses: php-actions/phpstan@v3 + with: + level: 9 + php_version: "8.2" + path: config/ routes/ src/ tests/Feature/ resources/views/ + - name: Stopping timer + if: ${{ !cancelled() }} + id: timer_end + env: + TIMESTAMP_START: ${{ steps.timer_start.outputs.TIMESTAMP_START }} + run: | + echo "DATE_END=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT + echo "DURATION_PHRASE=$(($(date +'%s')-$TIMESTAMP_START)) seconds" >> $GITHUB_OUTPUT + - name: "Slack notification: Done" + uses: slackapi/slack-github-action@v1.24.0 + with: + channel-id: 'C068A06PV43' + update-ts: ${{ steps.slack.outputs.ts }} + payload: | + { + "text": "CI Build Status for playground-matrix-resource: DONE\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": ":white_check_mark: CI Build Status for playground-matrix-resource" + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}" + }, + { + "type": "mrkdwn", + "text": "*End:*\n${{ steps.timer_end.outputs.DATE_END }}" + } + ] + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Status:* Success" + }, + { + "type": "mrkdwn", + "text": ":timer_clock: ${{ steps.timer_end.outputs.DURATION_PHRASE }}" + } + ] + }, + { + "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 }}" + } + } + ] + } + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + - name: "Send a notification for failures" + if: ${{ failure() }} + uses: slackapi/slack-github-action@v1.24.0 + with: + channel-id: 'C068A06PV43' + update-ts: ${{ steps.slack.outputs.ts }} + payload: | + { + "text": "CI Build Status for playground-matrix-resource: FAILED\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": ":warning: CI Build Status for playground-matrix-resource" + } + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}" + }, + { + "type": "mrkdwn", + "text": "*End:*\n${{ steps.timer_end.outputs.DATE_END }}" + } + ] + }, + { + "type": "section", + "fields": [ + { + "type": "mrkdwn", + "text": "*Status:* FAILED" + }, + { + "type": "mrkdwn", + "text": ":timer_clock: ${{ steps.timer_end.outputs.DURATION_PHRASE }}" + } + ] + }, + { + "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 }}" + } + } + ] + } + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} + diff --git a/.gitignore b/.gitignore index 3008a79..bc1c93d 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,8 @@ public/storage # Test ignores ################################################################################ +output + public/tests phpunit.xml diff --git a/.php-cs-fixer.dist b/.php-cs-fixer.dist.php similarity index 97% rename from .php-cs-fixer.dist rename to .php-cs-fixer.dist.php index ec6fa5a..d7f29d5 100644 --- a/.php-cs-fixer.dist +++ b/.php-cs-fixer.dist.php @@ -213,14 +213,13 @@ $finder = PhpCsFixer\Finder::create() ->in([ - __DIR__ . '/config', - __DIR__ . '/database', + __DIR__.'/config', + __DIR__.'/database', // __DIR__ . '/lang', - // __DIR__ . '/resources', - __DIR__ . '/routes', - __DIR__ . '/src', - // __DIR__ . '/tests/Feature', - __DIR__ . '/tests/Unit', + __DIR__.'/routes', + __DIR__.'/src', + __DIR__.'/tests/Feature', + // __DIR__ . '/tests/Unit', ]) ->name('*.php') ->notName('*.blade.php') diff --git a/README.md b/README.md index ebda250..0b9cf96 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Playground CI Workflow](https://github.com/gammamatrix/playground-matrix-resource/actions/workflows/ci.yml/badge.svg?branch=develop)](https://raw.githubusercontent.com/gammamatrix/playground-matrix-resource/testing/develop/testdox.txt) [![Test Coverage](https://raw.githubusercontent.com/gammamatrix/playground-matrix-resource/testing/develop/coverage.svg)](tests) +[![PHPStan Level 9 src and tests](https://img.shields.io/badge/PHPStan-level%209-brightgreen)](.github/workflows/ci.yml#L120) The `playground-matrix-resource` Laravel package. @@ -22,95 +23,68 @@ You can install the package via composer: composer require gammamatrix/playground-matrix-resource ``` +## About + +Playground provides information in the `artisan about` command. + +screenshot of artisan about command with Playground Matrix Resource. + +## Configuration + You can publish the config file with: ```bash -php artisan vendor:publish --provider="GammaMatrix\Playground\Matrix\Resource\ServiceProvider" --tag="playground-config" +php artisan vendor:publish --provider="Playground\Matrix\Resource\ServiceProvider" --tag="playground-config" ``` -## Configuration - All routes are enabled by default. They may be disabled via enviroment variable or the configuration. See the contents of the published config file: [config/playground-matrix-resource.php](config/playground-matrix-resource.php) You can publish the routes file with: ```bash -php artisan vendor:publish --provider="GammaMatrix\Playground\Matrix\Resource\ServiceProvider" --tag="playground-routes" +php artisan vendor:publish --provider="Playground\Matrix\Resource\ServiceProvider" --tag="playground-routes" ``` - The routes while be published in a folder at `routes/playground-matrix-resource` ### Environment Variables -#### Authentication and Authorization - -| env() | config() | -|-----------------------------------------------|-----------------------------------------------| -| `PLAYGROUND_MATRIX_RESOURCE_MIDDLEWARE` | `playground-matrix-resource.middleware` | -| `PLAYGROUND_MATRIX_RESOURCE_POLICY_NAMESPACE` | `playground-matrix-resource.policy_namespace` | - -If you do not want to use the flexible policies available in Playground, you may publish the routes to your base application and customize them and the middleware. - -The default middleware is set in [config/playground-matrix-resource.php](config/playground-matrix-resource.php) (may also be published): `auth:sanctum,web` - -If you wish to use your own policies, copy from [src/Policies](src/Policies). - -#### Loading +If you are unable or do not want to publish [configuration files for this package](config/playground-matrix-resource.php), +you may override the options via system environment variables. -| env() | config() | -|------------------------------------------|------------------------------------------| -| `PLAYGROUND_MATRIX_RESOURCE_LOAD_ROUTES` | `playground-matrix-resource.load.routes` | -| `PLAYGROUND_MATRIX_RESOURCE_LOAD_VIEWS` | `playground-matrix-resource.load.views` | +Information on [environment variables is available on the wiki for this package](https://github.com/gammamatrix/playground-matrix-resource/wiki/Environment-Variables) -##### Routes - -See the matrix routes: [routes](routes) +## Migrations -| env() | config() | -|------------------------------------------------|------------------------------------------------| -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_MATRIX` | `playground-matrix-resource.routes.matrix` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_BOARDS` | `playground-matrix-resource.routes.backlogs` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_EPICS` | `playground-matrix-resource.routes.boards` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_FLOWS` | `playground-matrix-resource.routes.epics` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_MILESTONES` | `playground-matrix-resource.routes.milestones` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_NOTES` | `playground-matrix-resource.routes.notes` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_PROJECTS` | `playground-matrix-resource.routes.projects` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_RELEASES` | `playground-matrix-resource.routes.releases` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_ROADMAPS` | `playground-matrix-resource.routes.roadmaps` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_SOURCES` | `playground-matrix-resource.routes.sources` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_SPRINTS` | `playground-matrix-resource.routes.sprints` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_TAGS` | `playground-matrix-resource.routes.tags` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_TEAMS` | `playground-matrix-resource.routes.teams` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_TICKETS` | `playground-matrix-resource.routes.tickets` | -| `PLAYGROUND_MATRIX_RESOURCE_ROUTES_VERSIONS` | `playground-matrix-resource.routes.versions` | +This package requires the migrations in [playground-matrix](https://github.com/gammamatrix/playground-matrix) a Laravel package. -### UI +## PHPStan -| env() | config() | -|---------------------------------------------|---------------------------------------------| -| `PLAYGROUND_MATRIX_RESOURCE_LAYOUT` | `playground-matrix-resource.layout` | -| `PLAYGROUND_MATRIX_RESOURCE_VIEW` | `playground-matrix-resource.view` | -| `PLAYGROUND_MATRIX_RESOURCE_SITEMAP_ENABLE` | `playground-matrix-resource.sitemap.enable` | -| `PLAYGROUND_MATRIX_RESOURCE_SITEMAP_GUEST` | `playground-matrix-resource.sitemap.guest` | -| `PLAYGROUND_MATRIX_RESOURCE_SITEMAP_USER` | `playground-matrix-resource.sitemap.user` | -| `PLAYGROUND_MATRIX_RESOURCE_SITEMAP_VIEW` | `playground-matrix-resource.sitemap.view` | +Tests at level 9 on: +- `config/` +- `database/` +- `resources/views/` +- `routes/` +- `src/` +- `tests/Feature/` +- `tests/Unit/` +```sh +composer analyse +``` -## Migrations +## Coding Standards -This package requires the migrations in [playground-matrix](https://github.com/gammamatrix/playground-matrix) a Laravel package. +```sh +composer format +``` ## Tests ```sh composer test ``` -## About - -Playground provides information in the `artisan about` command. - -screenshot of artisan about command with Playground Matrix Resource. ## Changelog diff --git a/composer.json b/composer.json index becf19a..72d770c 100644 --- a/composer.json +++ b/composer.json @@ -20,14 +20,23 @@ "role": "Developer" } ], + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/gammamatrix/playground-http.git" + } + ], "require": { "php": "^8.1", - "gammamatrix/playground": "dev-develop|dev-master|^73.0", - "gammamatrix/playground-matrix": "dev-develop|dev-master|^73.0" + "gammamatrix/playground-auth": "dev-develop|dev-master|dev-feature/*|^73.0", + "gammamatrix/playground-blade": "dev-develop|dev-master|dev-feature/*|^73.0", + "gammamatrix/playground-http": "dev-develop|dev-master|dev-feature/*|^73.0", + "gammamatrix/playground-login-blade": "dev-develop|dev-master|dev-feature/*|^73.0", + "gammamatrix/playground-site-blade": "dev-develop|dev-master|dev-feature/*|^73.0", + "gammamatrix/playground-matrix": "dev-develop|dev-master|dev-feature/*|^73.0" }, "require-dev": { - "gammamatrix/playground-auth": "dev-develop|dev-master|^73.0", - "gammamatrix/playground-test": "dev-develop|dev-master|^73.0" + "gammamatrix/playground-test": "dev-develop|dev-master|dev-feature/*|^73.0" }, "suggest": { "gammamatrix/playground-matrix": "Provides the models used by the Resource API in this package." @@ -36,13 +45,13 @@ "prefer-stable": true, "autoload": { "psr-4": { - "GammaMatrix\\Playground\\Matrix\\Resource\\": "src/" + "Playground\\Matrix\\Resource\\": "src/" } }, "autoload-dev": { "psr-4": { - "Tests\\Feature\\GammaMatrix\\Playground\\Matrix\\Resource\\": "tests/Feature/", - "Tests\\Unit\\GammaMatrix\\Playground\\Matrix\\Resource\\": "tests/Unit/" + "Tests\\Feature\\Playground\\Matrix\\Resource\\": "tests/Feature/", + "Tests\\Unit\\Playground\\Matrix\\Resource\\": "tests/Unit/" } }, "config": { @@ -59,13 +68,13 @@ }, "laravel": { "providers": [ - "GammaMatrix\\Playground\\Matrix\\Resource\\ServiceProvider" + "Playground\\Matrix\\Resource\\ServiceProvider" ] } }, "scripts": { - "test": "phpunit", - "format": "php-cs-fixer fix --allow-risky=yes", - "analyse": "phpstan analyse" + "test": "vendor/bin/phpunit", + "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 d68aece..92cce6f 100644 --- a/config/playground-matrix-resource.php +++ b/config/playground-matrix-resource.php @@ -1,12 +1,28 @@ (string) env('PLAYGROUND_MATRIX_RESOURCE_LAYOUT', 'playground::layouts.resource.layout'), - 'view' => (string) env('PLAYGROUND_MATRIX_RESOURCE_VIEW', 'playground::'), - 'middleware' => array_map('trim', explode(',', env('PLAYGROUND_MATRIX_RESOURCE_MIDDLEWARE', 'auth,web'))), - // 'middleware' => array_map('trim', explode(',', env('PLAYGROUND_MATRIX_RESOURCE_MIDDLEWARE', 'api,auth:sanctum,web'))), - // 'middleware' => array_map('trim', explode(',', env('PLAYGROUND_MATRIX_RESOURCE_MIDDLEWARE', 'auth:sanctum,web'))), - 'policy_namespace' => (string) env('PLAYGROUND_MATRIX_RESOURCE_POLICY_NAMESPACE', ''), + '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' => [ + 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\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, + Playground\Matrix\Models\Release::class => Playground\Matrix\Resource\Policies\ReleasePolicy::class, + Playground\Matrix\Models\Roadmap::class => Playground\Matrix\Resource\Policies\RoadmapPolicy::class, + Playground\Matrix\Models\Source::class => Playground\Matrix\Resource\Policies\SourcePolicy::class, + Playground\Matrix\Models\Sprint::class => Playground\Matrix\Resource\Policies\SprintPolicy::class, + Playground\Matrix\Models\Tag::class => Playground\Matrix\Resource\Policies\TagPolicy::class, + Playground\Matrix\Models\Team::class => Playground\Matrix\Resource\Policies\TeamPolicy::class, + 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), @@ -34,6 +50,7 @@ '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' => (string) env('PLAYGROUND_MATRIX_RESOURCE_SITEMAP_VIEW', 'playground-matrix-resource::sitemap'), + 'view' => env('PLAYGROUND_MATRIX_RESOURCE_SITEMAP_VIEW', 'playground-matrix-resource::sitemap'), ], + 'blade' => env('PLAYGROUND_MATRIX_RESOURCE_BLADE', 'playground-matrix-resource::'), ]; diff --git a/database/migrations-laravel/2014_10_12_000000_create_users_table.php b/database/migrations-laravel/2014_10_12_000000_create_users_table.php index 6c2b6d5..1f97419 100644 --- a/database/migrations-laravel/2014_10_12_000000_create_users_table.php +++ b/database/migrations-laravel/2014_10_12_000000_create_users_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class() extends Migration +{ /** * Run the migrations. */ diff --git a/database/migrations-laravel/2014_10_12_100000_create_password_reset_tokens_table.php b/database/migrations-laravel/2014_10_12_100000_create_password_reset_tokens_table.php index d8336e7..8b5b388 100644 --- a/database/migrations-laravel/2014_10_12_100000_create_password_reset_tokens_table.php +++ b/database/migrations-laravel/2014_10_12_100000_create_password_reset_tokens_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class() extends Migration +{ /** * Run the migrations. */ diff --git a/database/migrations-laravel/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations-laravel/2019_08_19_000000_create_failed_jobs_table.php index 667f82c..3eec77b 100644 --- a/database/migrations-laravel/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations-laravel/2019_08_19_000000_create_failed_jobs_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class() extends Migration +{ /** * Run the migrations. */ diff --git a/database/migrations-laravel/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations-laravel/2019_12_14_000001_create_personal_access_tokens_table.php index 668cd96..0fc7a63 100644 --- a/database/migrations-laravel/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/database/migrations-laravel/2019_12_14_000001_create_personal_access_tokens_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class() extends Migration +{ /** * Run the migrations. */ diff --git a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_backlogs_table.php b/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_backlogs_table.php index e6c0404..61d50ad 100644 --- a/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_backlogs_table.php +++ b/database/migrations-matrix-uuid/2020_01_02_100001_create_matrix_backlogs_table.php @@ -1,6 +1,6 @@ + + + + tests/Unit + + + tests/Feature + + + + + + + + + + + + + + + + + + + + + + src + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 6121002..2ea1899 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ - - - + + + - - + + - - - - + + + + @@ -58,18 +58,20 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/resources/views/backlog/detail.blade.php b/resources/views/backlog/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/backlog/detail.blade.php +++ b/resources/views/backlog/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/backlog/form.blade.php b/resources/views/backlog/form.blade.php index ef97fa2..83dd15a 100644 --- a/resources/views/backlog/form.blade.php +++ b/resources/views/backlog/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::backlog/form-info', 'withFormStatus' => 'playground-matrix-resource::backlog/form-status', ]) diff --git a/resources/views/backlog/index.blade.php b/resources/views/backlog/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/backlog/index.blade.php +++ b/resources/views/backlog/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/board/detail.blade.php b/resources/views/board/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/board/detail.blade.php +++ b/resources/views/board/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/board/form.blade.php b/resources/views/board/form.blade.php index 945bcb2..a3d5cf0 100644 --- a/resources/views/board/form.blade.php +++ b/resources/views/board/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::board/form-info', 'withFormStatus' => 'playground-matrix-resource::board/form-status', ]) diff --git a/resources/views/board/index.blade.php b/resources/views/board/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/board/index.blade.php +++ b/resources/views/board/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/epic/detail.blade.php b/resources/views/epic/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/epic/detail.blade.php +++ b/resources/views/epic/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/epic/form.blade.php b/resources/views/epic/form.blade.php index 2937af0..09d8a56 100644 --- a/resources/views/epic/form.blade.php +++ b/resources/views/epic/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::epic/form-info', 'withFormStatus' => 'playground-matrix-resource::epic/form-status', ]) diff --git a/resources/views/epic/index.blade.php b/resources/views/epic/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/epic/index.blade.php +++ b/resources/views/epic/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/flow/detail.blade.php b/resources/views/flow/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/flow/detail.blade.php +++ b/resources/views/flow/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/flow/form.blade.php b/resources/views/flow/form.blade.php index b745f67..0504abb 100644 --- a/resources/views/flow/form.blade.php +++ b/resources/views/flow/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::flow/form-info', 'withFormStatus' => 'playground-matrix-resource::flow/form-status', ]) diff --git a/resources/views/flow/index.blade.php b/resources/views/flow/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/flow/index.blade.php +++ b/resources/views/flow/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index 9ebd1bc..2589ec5 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -1,5 +1,3 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - @extends($playground_matrix_resource['layout']) @section('title', 'Matrix') diff --git a/resources/views/milestone/detail.blade.php b/resources/views/milestone/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/milestone/detail.blade.php +++ b/resources/views/milestone/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/milestone/form.blade.php b/resources/views/milestone/form.blade.php index bd7e261..85625b6 100644 --- a/resources/views/milestone/form.blade.php +++ b/resources/views/milestone/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::milestone/form-info', 'withFormStatus' => 'playground-matrix-resource::milestone/form-status', ]) diff --git a/resources/views/milestone/index.blade.php b/resources/views/milestone/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/milestone/index.blade.php +++ b/resources/views/milestone/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/note/detail.blade.php b/resources/views/note/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/note/detail.blade.php +++ b/resources/views/note/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/note/form.blade.php b/resources/views/note/form.blade.php index 1fc208a..6d9d20a 100644 --- a/resources/views/note/form.blade.php +++ b/resources/views/note/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::note/form-info', 'withFormStatus' => 'playground-matrix-resource::note/form-status', ]) diff --git a/resources/views/note/index.blade.php b/resources/views/note/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/note/index.blade.php +++ b/resources/views/note/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/project/detail.blade.php b/resources/views/project/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/project/detail.blade.php +++ b/resources/views/project/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/project/form.blade.php b/resources/views/project/form.blade.php index 794cd9f..639f0dc 100644 --- a/resources/views/project/form.blade.php +++ b/resources/views/project/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::project/form-info', 'withFormStatus' => 'playground-matrix-resource::project/form-status', ]) diff --git a/resources/views/project/index.blade.php b/resources/views/project/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/project/index.blade.php +++ b/resources/views/project/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/release/detail.blade.php b/resources/views/release/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/release/detail.blade.php +++ b/resources/views/release/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/release/form.blade.php b/resources/views/release/form.blade.php index aa10de4..9c4c09d 100644 --- a/resources/views/release/form.blade.php +++ b/resources/views/release/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::release/form-info', 'withFormStatus' => 'playground-matrix-resource::release/form-status', ]) diff --git a/resources/views/release/index.blade.php b/resources/views/release/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/release/index.blade.php +++ b/resources/views/release/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/roadmap/detail.blade.php b/resources/views/roadmap/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/roadmap/detail.blade.php +++ b/resources/views/roadmap/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/roadmap/form.blade.php b/resources/views/roadmap/form.blade.php index 757dc83..c9dce82 100644 --- a/resources/views/roadmap/form.blade.php +++ b/resources/views/roadmap/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::roadmap/form-info', 'withFormStatus' => 'playground-matrix-resource::roadmap/form-status', ]) diff --git a/resources/views/roadmap/index.blade.php b/resources/views/roadmap/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/roadmap/index.blade.php +++ b/resources/views/roadmap/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/source/detail.blade.php b/resources/views/source/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/source/detail.blade.php +++ b/resources/views/source/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/source/form.blade.php b/resources/views/source/form.blade.php index 6bb609b..ae6410a 100644 --- a/resources/views/source/form.blade.php +++ b/resources/views/source/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::source/form-info', 'withFormStatus' => 'playground-matrix-resource::source/form-status', ]) diff --git a/resources/views/source/index.blade.php b/resources/views/source/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/source/index.blade.php +++ b/resources/views/source/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/sprint/detail.blade.php b/resources/views/sprint/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/sprint/detail.blade.php +++ b/resources/views/sprint/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/sprint/form.blade.php b/resources/views/sprint/form.blade.php index 5e91e03..ea8d85a 100644 --- a/resources/views/sprint/form.blade.php +++ b/resources/views/sprint/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::sprint/form-info', 'withFormStatus' => 'playground-matrix-resource::sprint/form-status', ]) diff --git a/resources/views/sprint/index.blade.php b/resources/views/sprint/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/sprint/index.blade.php +++ b/resources/views/sprint/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/tag/detail.blade.php b/resources/views/tag/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/tag/detail.blade.php +++ b/resources/views/tag/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/tag/form.blade.php b/resources/views/tag/form.blade.php index aaf7da0..32316b5 100644 --- a/resources/views/tag/form.blade.php +++ b/resources/views/tag/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::tag/form-info', 'withFormStatus' => 'playground-matrix-resource::tag/form-status', ]) diff --git a/resources/views/tag/index.blade.php b/resources/views/tag/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/tag/index.blade.php +++ b/resources/views/tag/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/team/detail.blade.php b/resources/views/team/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/team/detail.blade.php +++ b/resources/views/team/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/team/form.blade.php b/resources/views/team/form.blade.php index 3824090..9fef37d 100644 --- a/resources/views/team/form.blade.php +++ b/resources/views/team/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::team/form-info', 'withFormStatus' => 'playground-matrix-resource::team/form-status', ]) diff --git a/resources/views/team/index.blade.php b/resources/views/team/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/team/index.blade.php +++ b/resources/views/team/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/ticket/detail.blade.php b/resources/views/ticket/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/ticket/detail.blade.php +++ b/resources/views/ticket/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/ticket/form.blade.php b/resources/views/ticket/form.blade.php index 95a19e3..a7b7250 100644 --- a/resources/views/ticket/form.blade.php +++ b/resources/views/ticket/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::ticket/form-info', 'withFormStatus' => 'playground-matrix-resource::ticket/form-status', ]) diff --git a/resources/views/ticket/index.blade.php b/resources/views/ticket/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/ticket/index.blade.php +++ b/resources/views/ticket/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/resources/views/version/detail.blade.php b/resources/views/version/detail.blade.php index cd517da..0349843 100644 --- a/resources/views/version/detail.blade.php +++ b/resources/views/version/detail.blade.php @@ -1,2 +1 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.detail')) +@extends('playground::layouts.resource.detail') diff --git a/resources/views/version/form.blade.php b/resources/views/version/form.blade.php index df0afc8..d713833 100644 --- a/resources/views/version/form.blade.php +++ b/resources/views/version/form.blade.php @@ -1,6 +1,4 @@ -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.form'), [ +@extends('playground::layouts.resource.form', [ 'withFormInfo' => 'playground-matrix-resource::version/form-info', 'withFormStatus' => 'playground-matrix-resource::version/form-status', ]) diff --git a/resources/views/version/index.blade.php b/resources/views/version/index.blade.php index 3dae6cc..32d2331 100644 --- a/resources/views/version/index.blade.php +++ b/resources/views/version/index.blade.php @@ -4,9 +4,7 @@ $validated = []; // $paginator = null; ?> -@php $playground_matrix_resource = config('playground-matrix-resource'); @endphp - -@extends(sprintf('%1$s%2$s', $playground_matrix_resource['view'], 'layouts.resource.index'), [ +@extends('playground::layouts.resource.index') // 'withTableColumns' => [ // 'label' => [ // 'linkType' => 'id', diff --git a/routes/backlogs.php b/routes/backlogs.php index e9f18c6..7f0dc45 100644 --- a/routes/backlogs.php +++ b/routes/backlogs.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/backlogs', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.backlogs', + 'as' => 'playground.matrix.resource.backlogs', 'uses' => 'BacklogController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Backlog::class); + ])->can('index', Playground\Matrix\Models\Backlog::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.backlogs.create', + 'as' => 'playground.matrix.resource.backlogs.create', 'uses' => 'BacklogController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Backlog::class); + ])->can('create', Playground\Matrix\Models\Backlog::class); Route::get('/edit/{backlog}', [ - 'as' => 'playground.matrix.resource.backlogs.edit', + 'as' => 'playground.matrix.resource.backlogs.edit', 'uses' => 'BacklogController@edit', ])->whereUuid('backlog') - ->can('edit', 'backlog') - ; + ->can('edit', 'backlog'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.backlogs.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{backlog}', [ - 'as' => 'playground.matrix.resource.backlogs.show', + 'as' => 'playground.matrix.resource.backlogs.show', 'uses' => 'BacklogController@show', ])->whereUuid('backlog') - ->can('detail', 'backlog') - ; + ->can('detail', 'backlog'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.backlogs.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.backlogs.store', // 'uses' => 'BacklogController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Backlog::class); + // ])->can('store', \Playground\Matrix\Models\Backlog::class); - # API + // API Route::put('/lock/{backlog}', [ - 'as' => 'playground.matrix.resource.backlogs.lock', + 'as' => 'playground.matrix.resource.backlogs.lock', 'uses' => 'BacklogController@lock', ])->whereUuid('backlog') - ->can('lock', 'backlog') - ; + ->can('lock', 'backlog'); Route::delete('/lock/{backlog}', [ - 'as' => 'playground.matrix.resource.backlogs.unlock', + 'as' => 'playground.matrix.resource.backlogs.unlock', 'uses' => 'BacklogController@unlock', ])->whereUuid('backlog') - ->can('unlock', 'backlog') - ; + ->can('unlock', 'backlog'); Route::delete('/{backlog}', [ - 'as' => 'playground.matrix.resource.backlogs.destroy', + 'as' => 'playground.matrix.resource.backlogs.destroy', 'uses' => 'BacklogController@destroy', ])->whereUuid('backlog') ->can('delete', 'backlog') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{backlog}', [ - 'as' => 'playground.matrix.resource.backlogs.restore', + 'as' => 'playground.matrix.resource.backlogs.restore', 'uses' => 'BacklogController@restore', ])->whereUuid('backlog') ->can('restore', 'backlog') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.backlogs.post', + 'as' => 'playground.matrix.resource.backlogs.post', 'uses' => 'BacklogController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Backlog::class); + ])->can('store', Playground\Matrix\Models\Backlog::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.backlogs.put', // 'uses' => 'BacklogController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Backlog::class); + // ])->can('store', \Playground\Matrix\Models\Backlog::class); // // Route::put('/{backlog}', [ // 'as' => 'playground.matrix.resource.backlogs.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('backlog')->can('update', 'backlog'); Route::patch('/{backlog}', [ - 'as' => 'playground.matrix.resource.backlogs.patch', + 'as' => 'playground.matrix.resource.backlogs.patch', 'uses' => 'BacklogController@update', ])->whereUuid('backlog')->can('update', 'backlog'); }); diff --git a/routes/boards.php b/routes/boards.php index 673715e..19d429f 100644 --- a/routes/boards.php +++ b/routes/boards.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/boards', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.boards', + 'as' => 'playground.matrix.resource.boards', 'uses' => 'BoardController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Board::class); + ])->can('index', Playground\Matrix\Models\Board::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.boards.create', + 'as' => 'playground.matrix.resource.boards.create', 'uses' => 'BoardController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Board::class); + ])->can('create', Playground\Matrix\Models\Board::class); Route::get('/edit/{board}', [ - 'as' => 'playground.matrix.resource.boards.edit', + 'as' => 'playground.matrix.resource.boards.edit', 'uses' => 'BoardController@edit', ])->whereUuid('board') - ->can('edit', 'board') - ; + ->can('edit', 'board'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.boards.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{board}', [ - 'as' => 'playground.matrix.resource.boards.show', + 'as' => 'playground.matrix.resource.boards.show', 'uses' => 'BoardController@show', ])->whereUuid('board') - ->can('detail', 'board') - ; + ->can('detail', 'board'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.boards.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.boards.store', // 'uses' => 'BoardController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Board::class); + // ])->can('store', \Playground\Matrix\Models\Board::class); - # API + // API Route::put('/lock/{board}', [ - 'as' => 'playground.matrix.resource.boards.lock', + 'as' => 'playground.matrix.resource.boards.lock', 'uses' => 'BoardController@lock', ])->whereUuid('board') - ->can('lock', 'board') - ; + ->can('lock', 'board'); Route::delete('/lock/{board}', [ - 'as' => 'playground.matrix.resource.boards.unlock', + 'as' => 'playground.matrix.resource.boards.unlock', 'uses' => 'BoardController@unlock', ])->whereUuid('board') - ->can('unlock', 'board') - ; + ->can('unlock', 'board'); Route::delete('/{board}', [ - 'as' => 'playground.matrix.resource.boards.destroy', + 'as' => 'playground.matrix.resource.boards.destroy', 'uses' => 'BoardController@destroy', ])->whereUuid('board') ->can('delete', 'board') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{board}', [ - 'as' => 'playground.matrix.resource.boards.restore', + 'as' => 'playground.matrix.resource.boards.restore', 'uses' => 'BoardController@restore', ])->whereUuid('board') ->can('restore', 'board') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.boards.post', + 'as' => 'playground.matrix.resource.boards.post', 'uses' => 'BoardController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Board::class); + ])->can('store', Playground\Matrix\Models\Board::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.boards.put', // 'uses' => 'BoardController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Board::class); + // ])->can('store', \Playground\Matrix\Models\Board::class); // // Route::put('/{board}', [ // 'as' => 'playground.matrix.resource.boards.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('board')->can('update', 'board'); Route::patch('/{board}', [ - 'as' => 'playground.matrix.resource.boards.patch', + 'as' => 'playground.matrix.resource.boards.patch', 'uses' => 'BoardController@update', ])->whereUuid('board')->can('update', 'board'); }); diff --git a/routes/epics.php b/routes/epics.php index e1891f9..c11ab06 100644 --- a/routes/epics.php +++ b/routes/epics.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/epics', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.epics', + 'as' => 'playground.matrix.resource.epics', 'uses' => 'EpicController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Epic::class); + ])->can('index', Playground\Matrix\Models\Epic::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.epics.create', + 'as' => 'playground.matrix.resource.epics.create', 'uses' => 'EpicController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Epic::class); + ])->can('create', Playground\Matrix\Models\Epic::class); Route::get('/edit/{epic}', [ - 'as' => 'playground.matrix.resource.epics.edit', + 'as' => 'playground.matrix.resource.epics.edit', 'uses' => 'EpicController@edit', ])->whereUuid('epic') - ->can('edit', 'epic') - ; + ->can('edit', 'epic'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.epics.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{epic}', [ - 'as' => 'playground.matrix.resource.epics.show', + 'as' => 'playground.matrix.resource.epics.show', 'uses' => 'EpicController@show', ])->whereUuid('epic') - ->can('detail', 'epic') - ; + ->can('detail', 'epic'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.epics.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.epics.store', // 'uses' => 'EpicController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Epic::class); + // ])->can('store', \Playground\Matrix\Models\Epic::class); - # API + // API Route::put('/lock/{epic}', [ - 'as' => 'playground.matrix.resource.epics.lock', + 'as' => 'playground.matrix.resource.epics.lock', 'uses' => 'EpicController@lock', ])->whereUuid('epic') - ->can('lock', 'epic') - ; + ->can('lock', 'epic'); Route::delete('/lock/{epic}', [ - 'as' => 'playground.matrix.resource.epics.unlock', + 'as' => 'playground.matrix.resource.epics.unlock', 'uses' => 'EpicController@unlock', ])->whereUuid('epic') - ->can('unlock', 'epic') - ; + ->can('unlock', 'epic'); Route::delete('/{epic}', [ - 'as' => 'playground.matrix.resource.epics.destroy', + 'as' => 'playground.matrix.resource.epics.destroy', 'uses' => 'EpicController@destroy', ])->whereUuid('epic') ->can('delete', 'epic') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{epic}', [ - 'as' => 'playground.matrix.resource.epics.restore', + 'as' => 'playground.matrix.resource.epics.restore', 'uses' => 'EpicController@restore', ])->whereUuid('epic') ->can('restore', 'epic') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.epics.post', + 'as' => 'playground.matrix.resource.epics.post', 'uses' => 'EpicController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Epic::class); + ])->can('store', Playground\Matrix\Models\Epic::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.epics.put', // 'uses' => 'EpicController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Epic::class); + // ])->can('store', \Playground\Matrix\Models\Epic::class); // // Route::put('/{epic}', [ // 'as' => 'playground.matrix.resource.epics.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('epic')->can('update', 'epic'); Route::patch('/{epic}', [ - 'as' => 'playground.matrix.resource.epics.patch', + 'as' => 'playground.matrix.resource.epics.patch', 'uses' => 'EpicController@update', ])->whereUuid('epic')->can('update', 'epic'); }); diff --git a/routes/flows.php b/routes/flows.php index 3f56ca5..866058a 100644 --- a/routes/flows.php +++ b/routes/flows.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/flows', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.flows', + 'as' => 'playground.matrix.resource.flows', 'uses' => 'FlowController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Flow::class); + ])->can('index', Playground\Matrix\Models\Flow::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.flows.create', + 'as' => 'playground.matrix.resource.flows.create', 'uses' => 'FlowController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Flow::class); + ])->can('create', Playground\Matrix\Models\Flow::class); Route::get('/edit/{flow}', [ - 'as' => 'playground.matrix.resource.flows.edit', + 'as' => 'playground.matrix.resource.flows.edit', 'uses' => 'FlowController@edit', ])->whereUuid('flow') - ->can('edit', 'flow') - ; + ->can('edit', 'flow'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.flows.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{flow}', [ - 'as' => 'playground.matrix.resource.flows.show', + 'as' => 'playground.matrix.resource.flows.show', 'uses' => 'FlowController@show', ])->whereUuid('flow') - ->can('detail', 'flow') - ; + ->can('detail', 'flow'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.flows.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.flows.store', // 'uses' => 'FlowController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Flow::class); + // ])->can('store', \Playground\Matrix\Models\Flow::class); - # API + // API Route::put('/lock/{flow}', [ - 'as' => 'playground.matrix.resource.flows.lock', + 'as' => 'playground.matrix.resource.flows.lock', 'uses' => 'FlowController@lock', ])->whereUuid('flow') - ->can('lock', 'flow') - ; + ->can('lock', 'flow'); Route::delete('/lock/{flow}', [ - 'as' => 'playground.matrix.resource.flows.unlock', + 'as' => 'playground.matrix.resource.flows.unlock', 'uses' => 'FlowController@unlock', ])->whereUuid('flow') - ->can('unlock', 'flow') - ; + ->can('unlock', 'flow'); Route::delete('/{flow}', [ - 'as' => 'playground.matrix.resource.flows.destroy', + 'as' => 'playground.matrix.resource.flows.destroy', 'uses' => 'FlowController@destroy', ])->whereUuid('flow') ->can('delete', 'flow') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{flow}', [ - 'as' => 'playground.matrix.resource.flows.restore', + 'as' => 'playground.matrix.resource.flows.restore', 'uses' => 'FlowController@restore', ])->whereUuid('flow') ->can('restore', 'flow') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.flows.post', + 'as' => 'playground.matrix.resource.flows.post', 'uses' => 'FlowController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Flow::class); + ])->can('store', Playground\Matrix\Models\Flow::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.flows.put', // 'uses' => 'FlowController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Flow::class); + // ])->can('store', \Playground\Matrix\Models\Flow::class); // // Route::put('/{flow}', [ // 'as' => 'playground.matrix.resource.flows.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('flow')->can('update', 'flow'); Route::patch('/{flow}', [ - 'as' => 'playground.matrix.resource.flows.patch', + 'as' => 'playground.matrix.resource.flows.patch', 'uses' => 'FlowController@update', ])->whereUuid('flow')->can('update', 'flow'); }); diff --git a/routes/matrix.php b/routes/matrix.php index bacd679..b2b6f6d 100644 --- a/routes/matrix.php +++ b/routes/matrix.php @@ -13,10 +13,10 @@ Route::group([ 'prefix' => 'resource/matrix', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource', + 'as' => 'playground.matrix.resource', 'uses' => 'IndexController@index', ]); }); diff --git a/routes/milestones.php b/routes/milestones.php index 87d52ca..0de0918 100644 --- a/routes/milestones.php +++ b/routes/milestones.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/milestones', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.milestones', + 'as' => 'playground.matrix.resource.milestones', 'uses' => 'MilestoneController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Milestone::class); + ])->can('index', Playground\Matrix\Models\Milestone::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.milestones.create', + 'as' => 'playground.matrix.resource.milestones.create', 'uses' => 'MilestoneController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Milestone::class); + ])->can('create', Playground\Matrix\Models\Milestone::class); Route::get('/edit/{milestone}', [ - 'as' => 'playground.matrix.resource.milestones.edit', + 'as' => 'playground.matrix.resource.milestones.edit', 'uses' => 'MilestoneController@edit', ])->whereUuid('milestone') - ->can('edit', 'milestone') - ; + ->can('edit', 'milestone'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.milestones.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{milestone}', [ - 'as' => 'playground.matrix.resource.milestones.show', + 'as' => 'playground.matrix.resource.milestones.show', 'uses' => 'MilestoneController@show', ])->whereUuid('milestone') - ->can('detail', 'milestone') - ; + ->can('detail', 'milestone'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.milestones.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.milestones.store', // 'uses' => 'MilestoneController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Milestone::class); + // ])->can('store', \Playground\Matrix\Models\Milestone::class); - # API + // API Route::put('/lock/{milestone}', [ - 'as' => 'playground.matrix.resource.milestones.lock', + 'as' => 'playground.matrix.resource.milestones.lock', 'uses' => 'MilestoneController@lock', ])->whereUuid('milestone') - ->can('lock', 'milestone') - ; + ->can('lock', 'milestone'); Route::delete('/lock/{milestone}', [ - 'as' => 'playground.matrix.resource.milestones.unlock', + 'as' => 'playground.matrix.resource.milestones.unlock', 'uses' => 'MilestoneController@unlock', ])->whereUuid('milestone') - ->can('unlock', 'milestone') - ; + ->can('unlock', 'milestone'); Route::delete('/{milestone}', [ - 'as' => 'playground.matrix.resource.milestones.destroy', + 'as' => 'playground.matrix.resource.milestones.destroy', 'uses' => 'MilestoneController@destroy', ])->whereUuid('milestone') ->can('delete', 'milestone') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{milestone}', [ - 'as' => 'playground.matrix.resource.milestones.restore', + 'as' => 'playground.matrix.resource.milestones.restore', 'uses' => 'MilestoneController@restore', ])->whereUuid('milestone') ->can('restore', 'milestone') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.milestones.post', + 'as' => 'playground.matrix.resource.milestones.post', 'uses' => 'MilestoneController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Milestone::class); + ])->can('store', Playground\Matrix\Models\Milestone::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.milestones.put', // 'uses' => 'MilestoneController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Milestone::class); + // ])->can('store', \Playground\Matrix\Models\Milestone::class); // // Route::put('/{milestone}', [ // 'as' => 'playground.matrix.resource.milestones.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('milestone')->can('update', 'milestone'); Route::patch('/{milestone}', [ - 'as' => 'playground.matrix.resource.milestones.patch', + 'as' => 'playground.matrix.resource.milestones.patch', 'uses' => 'MilestoneController@update', ])->whereUuid('milestone')->can('update', 'milestone'); }); diff --git a/routes/notes.php b/routes/notes.php index 26979c0..1e0f421 100644 --- a/routes/notes.php +++ b/routes/notes.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/notes', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.notes', + 'as' => 'playground.matrix.resource.notes', 'uses' => 'NoteController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Note::class); + ])->can('index', Playground\Matrix\Models\Note::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.notes.create', + 'as' => 'playground.matrix.resource.notes.create', 'uses' => 'NoteController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Note::class); + ])->can('create', Playground\Matrix\Models\Note::class); Route::get('/edit/{note}', [ - 'as' => 'playground.matrix.resource.notes.edit', + 'as' => 'playground.matrix.resource.notes.edit', 'uses' => 'NoteController@edit', ])->whereUuid('note') - ->can('edit', 'note') - ; + ->can('edit', 'note'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.notes.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{note}', [ - 'as' => 'playground.matrix.resource.notes.show', + 'as' => 'playground.matrix.resource.notes.show', 'uses' => 'NoteController@show', ])->whereUuid('note') - ->can('detail', 'note') - ; + ->can('detail', 'note'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.notes.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.notes.store', // 'uses' => 'NoteController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Note::class); + // ])->can('store', \Playground\Matrix\Models\Note::class); - # API + // API Route::put('/lock/{note}', [ - 'as' => 'playground.matrix.resource.notes.lock', + 'as' => 'playground.matrix.resource.notes.lock', 'uses' => 'NoteController@lock', ])->whereUuid('note') - ->can('lock', 'note') - ; + ->can('lock', 'note'); Route::delete('/lock/{note}', [ - 'as' => 'playground.matrix.resource.notes.unlock', + 'as' => 'playground.matrix.resource.notes.unlock', 'uses' => 'NoteController@unlock', ])->whereUuid('note') - ->can('unlock', 'note') - ; + ->can('unlock', 'note'); Route::delete('/{note}', [ - 'as' => 'playground.matrix.resource.notes.destroy', + 'as' => 'playground.matrix.resource.notes.destroy', 'uses' => 'NoteController@destroy', ])->whereUuid('note') ->can('delete', 'note') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{note}', [ - 'as' => 'playground.matrix.resource.notes.restore', + 'as' => 'playground.matrix.resource.notes.restore', 'uses' => 'NoteController@restore', ])->whereUuid('note') ->can('restore', 'note') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.notes.post', + 'as' => 'playground.matrix.resource.notes.post', 'uses' => 'NoteController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Note::class); + ])->can('store', Playground\Matrix\Models\Note::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.notes.put', // 'uses' => 'NoteController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Note::class); + // ])->can('store', \Playground\Matrix\Models\Note::class); // // Route::put('/{note}', [ // 'as' => 'playground.matrix.resource.notes.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('note')->can('update', 'note'); Route::patch('/{note}', [ - 'as' => 'playground.matrix.resource.notes.patch', + 'as' => 'playground.matrix.resource.notes.patch', 'uses' => 'NoteController@update', ])->whereUuid('note')->can('update', 'note'); }); diff --git a/routes/projects.php b/routes/projects.php index 6acac2d..d768e36 100644 --- a/routes/projects.php +++ b/routes/projects.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/projects', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.projects', + 'as' => 'playground.matrix.resource.projects', 'uses' => 'ProjectController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Project::class); + ])->can('index', Playground\Matrix\Models\Project::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.projects.create', + 'as' => 'playground.matrix.resource.projects.create', 'uses' => 'ProjectController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Project::class); + ])->can('create', Playground\Matrix\Models\Project::class); Route::get('/edit/{project}', [ - 'as' => 'playground.matrix.resource.projects.edit', + 'as' => 'playground.matrix.resource.projects.edit', 'uses' => 'ProjectController@edit', ])->whereUuid('project') - ->can('edit', 'project') - ; + ->can('edit', 'project'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.projects.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{project}', [ - 'as' => 'playground.matrix.resource.projects.show', + 'as' => 'playground.matrix.resource.projects.show', 'uses' => 'ProjectController@show', ])->whereUuid('project') - ->can('detail', 'project') - ; + ->can('detail', 'project'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.projects.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.projects.store', // 'uses' => 'ProjectController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Project::class); + // ])->can('store', \Playground\Matrix\Models\Project::class); - # API + // API Route::put('/lock/{project}', [ - 'as' => 'playground.matrix.resource.projects.lock', + 'as' => 'playground.matrix.resource.projects.lock', 'uses' => 'ProjectController@lock', ])->whereUuid('project') - ->can('lock', 'project') - ; + ->can('lock', 'project'); Route::delete('/lock/{project}', [ - 'as' => 'playground.matrix.resource.projects.unlock', + 'as' => 'playground.matrix.resource.projects.unlock', 'uses' => 'ProjectController@unlock', ])->whereUuid('project') - ->can('unlock', 'project') - ; + ->can('unlock', 'project'); Route::delete('/{project}', [ - 'as' => 'playground.matrix.resource.projects.destroy', + 'as' => 'playground.matrix.resource.projects.destroy', 'uses' => 'ProjectController@destroy', ])->whereUuid('project') ->can('delete', 'project') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{project}', [ - 'as' => 'playground.matrix.resource.projects.restore', + 'as' => 'playground.matrix.resource.projects.restore', 'uses' => 'ProjectController@restore', ])->whereUuid('project') ->can('restore', 'project') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.projects.post', + 'as' => 'playground.matrix.resource.projects.post', 'uses' => 'ProjectController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Project::class); + ])->can('store', Playground\Matrix\Models\Project::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.projects.put', // 'uses' => 'ProjectController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Project::class); + // ])->can('store', \Playground\Matrix\Models\Project::class); // // Route::put('/{project}', [ // 'as' => 'playground.matrix.resource.projects.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('project')->can('update', 'project'); Route::patch('/{project}', [ - 'as' => 'playground.matrix.resource.projects.patch', + 'as' => 'playground.matrix.resource.projects.patch', 'uses' => 'ProjectController@update', ])->whereUuid('project')->can('update', 'project'); }); diff --git a/routes/releases.php b/routes/releases.php index ada8f15..5c66933 100644 --- a/routes/releases.php +++ b/routes/releases.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/releases', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.releases', + 'as' => 'playground.matrix.resource.releases', 'uses' => 'ReleaseController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Release::class); + ])->can('index', Playground\Matrix\Models\Release::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.releases.create', + 'as' => 'playground.matrix.resource.releases.create', 'uses' => 'ReleaseController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Release::class); + ])->can('create', Playground\Matrix\Models\Release::class); Route::get('/edit/{release}', [ - 'as' => 'playground.matrix.resource.releases.edit', + 'as' => 'playground.matrix.resource.releases.edit', 'uses' => 'ReleaseController@edit', ])->whereUuid('release') - ->can('edit', 'release') - ; + ->can('edit', 'release'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.releases.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{release}', [ - 'as' => 'playground.matrix.resource.releases.show', + 'as' => 'playground.matrix.resource.releases.show', 'uses' => 'ReleaseController@show', ])->whereUuid('release') - ->can('detail', 'release') - ; + ->can('detail', 'release'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.releases.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.releases.store', // 'uses' => 'ReleaseController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Release::class); + // ])->can('store', \Playground\Matrix\Models\Release::class); - # API + // API Route::put('/lock/{release}', [ - 'as' => 'playground.matrix.resource.releases.lock', + 'as' => 'playground.matrix.resource.releases.lock', 'uses' => 'ReleaseController@lock', ])->whereUuid('release') - ->can('lock', 'release') - ; + ->can('lock', 'release'); Route::delete('/lock/{release}', [ - 'as' => 'playground.matrix.resource.releases.unlock', + 'as' => 'playground.matrix.resource.releases.unlock', 'uses' => 'ReleaseController@unlock', ])->whereUuid('release') - ->can('unlock', 'release') - ; + ->can('unlock', 'release'); Route::delete('/{release}', [ - 'as' => 'playground.matrix.resource.releases.destroy', + 'as' => 'playground.matrix.resource.releases.destroy', 'uses' => 'ReleaseController@destroy', ])->whereUuid('release') ->can('delete', 'release') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{release}', [ - 'as' => 'playground.matrix.resource.releases.restore', + 'as' => 'playground.matrix.resource.releases.restore', 'uses' => 'ReleaseController@restore', ])->whereUuid('release') ->can('restore', 'release') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.releases.post', + 'as' => 'playground.matrix.resource.releases.post', 'uses' => 'ReleaseController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Release::class); + ])->can('store', Playground\Matrix\Models\Release::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.releases.put', // 'uses' => 'ReleaseController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Release::class); + // ])->can('store', \Playground\Matrix\Models\Release::class); // // Route::put('/{release}', [ // 'as' => 'playground.matrix.resource.releases.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('release')->can('update', 'release'); Route::patch('/{release}', [ - 'as' => 'playground.matrix.resource.releases.patch', + 'as' => 'playground.matrix.resource.releases.patch', 'uses' => 'ReleaseController@update', ])->whereUuid('release')->can('update', 'release'); }); diff --git a/routes/roadmaps.php b/routes/roadmaps.php index b884138..d06c555 100644 --- a/routes/roadmaps.php +++ b/routes/roadmaps.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/roadmaps', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.roadmaps', + 'as' => 'playground.matrix.resource.roadmaps', 'uses' => 'RoadmapController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Roadmap::class); + ])->can('index', Playground\Matrix\Models\Roadmap::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.roadmaps.create', + 'as' => 'playground.matrix.resource.roadmaps.create', 'uses' => 'RoadmapController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Roadmap::class); + ])->can('create', Playground\Matrix\Models\Roadmap::class); Route::get('/edit/{roadmap}', [ - 'as' => 'playground.matrix.resource.roadmaps.edit', + 'as' => 'playground.matrix.resource.roadmaps.edit', 'uses' => 'RoadmapController@edit', ])->whereUuid('roadmap') - ->can('edit', 'roadmap') - ; + ->can('edit', 'roadmap'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.roadmaps.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{roadmap}', [ - 'as' => 'playground.matrix.resource.roadmaps.show', + 'as' => 'playground.matrix.resource.roadmaps.show', 'uses' => 'RoadmapController@show', ])->whereUuid('roadmap') - ->can('detail', 'roadmap') - ; + ->can('detail', 'roadmap'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.roadmaps.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.roadmaps.store', // 'uses' => 'RoadmapController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Roadmap::class); + // ])->can('store', \Playground\Matrix\Models\Roadmap::class); - # API + // API Route::put('/lock/{roadmap}', [ - 'as' => 'playground.matrix.resource.roadmaps.lock', + 'as' => 'playground.matrix.resource.roadmaps.lock', 'uses' => 'RoadmapController@lock', ])->whereUuid('roadmap') - ->can('lock', 'roadmap') - ; + ->can('lock', 'roadmap'); Route::delete('/lock/{roadmap}', [ - 'as' => 'playground.matrix.resource.roadmaps.unlock', + 'as' => 'playground.matrix.resource.roadmaps.unlock', 'uses' => 'RoadmapController@unlock', ])->whereUuid('roadmap') - ->can('unlock', 'roadmap') - ; + ->can('unlock', 'roadmap'); Route::delete('/{roadmap}', [ - 'as' => 'playground.matrix.resource.roadmaps.destroy', + 'as' => 'playground.matrix.resource.roadmaps.destroy', 'uses' => 'RoadmapController@destroy', ])->whereUuid('roadmap') ->can('delete', 'roadmap') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{roadmap}', [ - 'as' => 'playground.matrix.resource.roadmaps.restore', + 'as' => 'playground.matrix.resource.roadmaps.restore', 'uses' => 'RoadmapController@restore', ])->whereUuid('roadmap') ->can('restore', 'roadmap') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.roadmaps.post', + 'as' => 'playground.matrix.resource.roadmaps.post', 'uses' => 'RoadmapController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Roadmap::class); + ])->can('store', Playground\Matrix\Models\Roadmap::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.roadmaps.put', // 'uses' => 'RoadmapController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Roadmap::class); + // ])->can('store', \Playground\Matrix\Models\Roadmap::class); // // Route::put('/{roadmap}', [ // 'as' => 'playground.matrix.resource.roadmaps.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('roadmap')->can('update', 'roadmap'); Route::patch('/{roadmap}', [ - 'as' => 'playground.matrix.resource.roadmaps.patch', + 'as' => 'playground.matrix.resource.roadmaps.patch', 'uses' => 'RoadmapController@update', ])->whereUuid('roadmap')->can('update', 'roadmap'); }); diff --git a/routes/sources.php b/routes/sources.php index b22874e..b87538d 100644 --- a/routes/sources.php +++ b/routes/sources.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/sources', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.sources', + 'as' => 'playground.matrix.resource.sources', 'uses' => 'SourceController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Source::class); + ])->can('index', Playground\Matrix\Models\Source::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.sources.create', + 'as' => 'playground.matrix.resource.sources.create', 'uses' => 'SourceController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Source::class); + ])->can('create', Playground\Matrix\Models\Source::class); Route::get('/edit/{source}', [ - 'as' => 'playground.matrix.resource.sources.edit', + 'as' => 'playground.matrix.resource.sources.edit', 'uses' => 'SourceController@edit', ])->whereUuid('source') - ->can('edit', 'source') - ; + ->can('edit', 'source'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.sources.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{source}', [ - 'as' => 'playground.matrix.resource.sources.show', + 'as' => 'playground.matrix.resource.sources.show', 'uses' => 'SourceController@show', ])->whereUuid('source') - ->can('detail', 'source') - ; + ->can('detail', 'source'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.sources.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.sources.store', // 'uses' => 'SourceController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Source::class); + // ])->can('store', \Playground\Matrix\Models\Source::class); - # API + // API Route::put('/lock/{source}', [ - 'as' => 'playground.matrix.resource.sources.lock', + 'as' => 'playground.matrix.resource.sources.lock', 'uses' => 'SourceController@lock', ])->whereUuid('source') - ->can('lock', 'source') - ; + ->can('lock', 'source'); Route::delete('/lock/{source}', [ - 'as' => 'playground.matrix.resource.sources.unlock', + 'as' => 'playground.matrix.resource.sources.unlock', 'uses' => 'SourceController@unlock', ])->whereUuid('source') - ->can('unlock', 'source') - ; + ->can('unlock', 'source'); Route::delete('/{source}', [ - 'as' => 'playground.matrix.resource.sources.destroy', + 'as' => 'playground.matrix.resource.sources.destroy', 'uses' => 'SourceController@destroy', ])->whereUuid('source') ->can('delete', 'source') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{source}', [ - 'as' => 'playground.matrix.resource.sources.restore', + 'as' => 'playground.matrix.resource.sources.restore', 'uses' => 'SourceController@restore', ])->whereUuid('source') ->can('restore', 'source') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.sources.post', + 'as' => 'playground.matrix.resource.sources.post', 'uses' => 'SourceController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Source::class); + ])->can('store', Playground\Matrix\Models\Source::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.sources.put', // 'uses' => 'SourceController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Source::class); + // ])->can('store', \Playground\Matrix\Models\Source::class); // // Route::put('/{source}', [ // 'as' => 'playground.matrix.resource.sources.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('source')->can('update', 'source'); Route::patch('/{source}', [ - 'as' => 'playground.matrix.resource.sources.patch', + 'as' => 'playground.matrix.resource.sources.patch', 'uses' => 'SourceController@update', ])->whereUuid('source')->can('update', 'source'); }); diff --git a/routes/sprints.php b/routes/sprints.php index ed7bf06..c4aad45 100644 --- a/routes/sprints.php +++ b/routes/sprints.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/sprints', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.sprints', + 'as' => 'playground.matrix.resource.sprints', 'uses' => 'SprintController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Sprint::class); + ])->can('index', Playground\Matrix\Models\Sprint::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.sprints.create', + 'as' => 'playground.matrix.resource.sprints.create', 'uses' => 'SprintController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Sprint::class); + ])->can('create', Playground\Matrix\Models\Sprint::class); Route::get('/edit/{sprint}', [ - 'as' => 'playground.matrix.resource.sprints.edit', + 'as' => 'playground.matrix.resource.sprints.edit', 'uses' => 'SprintController@edit', ])->whereUuid('sprint') - ->can('edit', 'sprint') - ; + ->can('edit', 'sprint'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.sprints.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{sprint}', [ - 'as' => 'playground.matrix.resource.sprints.show', + 'as' => 'playground.matrix.resource.sprints.show', 'uses' => 'SprintController@show', ])->whereUuid('sprint') - ->can('detail', 'sprint') - ; + ->can('detail', 'sprint'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.sprints.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.sprints.store', // 'uses' => 'SprintController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Sprint::class); + // ])->can('store', \Playground\Matrix\Models\Sprint::class); - # API + // API Route::put('/lock/{sprint}', [ - 'as' => 'playground.matrix.resource.sprints.lock', + 'as' => 'playground.matrix.resource.sprints.lock', 'uses' => 'SprintController@lock', ])->whereUuid('sprint') - ->can('lock', 'sprint') - ; + ->can('lock', 'sprint'); Route::delete('/lock/{sprint}', [ - 'as' => 'playground.matrix.resource.sprints.unlock', + 'as' => 'playground.matrix.resource.sprints.unlock', 'uses' => 'SprintController@unlock', ])->whereUuid('sprint') - ->can('unlock', 'sprint') - ; + ->can('unlock', 'sprint'); Route::delete('/{sprint}', [ - 'as' => 'playground.matrix.resource.sprints.destroy', + 'as' => 'playground.matrix.resource.sprints.destroy', 'uses' => 'SprintController@destroy', ])->whereUuid('sprint') ->can('delete', 'sprint') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{sprint}', [ - 'as' => 'playground.matrix.resource.sprints.restore', + 'as' => 'playground.matrix.resource.sprints.restore', 'uses' => 'SprintController@restore', ])->whereUuid('sprint') ->can('restore', 'sprint') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.sprints.post', + 'as' => 'playground.matrix.resource.sprints.post', 'uses' => 'SprintController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Sprint::class); + ])->can('store', Playground\Matrix\Models\Sprint::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.sprints.put', // 'uses' => 'SprintController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Sprint::class); + // ])->can('store', \Playground\Matrix\Models\Sprint::class); // // Route::put('/{sprint}', [ // 'as' => 'playground.matrix.resource.sprints.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('sprint')->can('update', 'sprint'); Route::patch('/{sprint}', [ - 'as' => 'playground.matrix.resource.sprints.patch', + 'as' => 'playground.matrix.resource.sprints.patch', 'uses' => 'SprintController@update', ])->whereUuid('sprint')->can('update', 'sprint'); }); diff --git a/routes/tags.php b/routes/tags.php index 7795828..431551e 100644 --- a/routes/tags.php +++ b/routes/tags.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/tags', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.tags', + 'as' => 'playground.matrix.resource.tags', 'uses' => 'TagController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Tag::class); + ])->can('index', Playground\Matrix\Models\Tag::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.tags.create', + 'as' => 'playground.matrix.resource.tags.create', 'uses' => 'TagController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Tag::class); + ])->can('create', Playground\Matrix\Models\Tag::class); Route::get('/edit/{tag}', [ - 'as' => 'playground.matrix.resource.tags.edit', + 'as' => 'playground.matrix.resource.tags.edit', 'uses' => 'TagController@edit', ])->whereUuid('tag') - ->can('edit', 'tag') - ; + ->can('edit', 'tag'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.tags.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{tag}', [ - 'as' => 'playground.matrix.resource.tags.show', + 'as' => 'playground.matrix.resource.tags.show', 'uses' => 'TagController@show', ])->whereUuid('tag') - ->can('detail', 'tag') - ; + ->can('detail', 'tag'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.tags.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.tags.store', // 'uses' => 'TagController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Tag::class); + // ])->can('store', \Playground\Matrix\Models\Tag::class); - # API + // API Route::put('/lock/{tag}', [ - 'as' => 'playground.matrix.resource.tags.lock', + 'as' => 'playground.matrix.resource.tags.lock', 'uses' => 'TagController@lock', ])->whereUuid('tag') - ->can('lock', 'tag') - ; + ->can('lock', 'tag'); Route::delete('/lock/{tag}', [ - 'as' => 'playground.matrix.resource.tags.unlock', + 'as' => 'playground.matrix.resource.tags.unlock', 'uses' => 'TagController@unlock', ])->whereUuid('tag') - ->can('unlock', 'tag') - ; + ->can('unlock', 'tag'); Route::delete('/{tag}', [ - 'as' => 'playground.matrix.resource.tags.destroy', + 'as' => 'playground.matrix.resource.tags.destroy', 'uses' => 'TagController@destroy', ])->whereUuid('tag') ->can('delete', 'tag') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{tag}', [ - 'as' => 'playground.matrix.resource.tags.restore', + 'as' => 'playground.matrix.resource.tags.restore', 'uses' => 'TagController@restore', ])->whereUuid('tag') ->can('restore', 'tag') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.tags.post', + 'as' => 'playground.matrix.resource.tags.post', 'uses' => 'TagController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Tag::class); + ])->can('store', Playground\Matrix\Models\Tag::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.tags.put', // 'uses' => 'TagController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Tag::class); + // ])->can('store', \Playground\Matrix\Models\Tag::class); // // Route::put('/{tag}', [ // 'as' => 'playground.matrix.resource.tags.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('tag')->can('update', 'tag'); Route::patch('/{tag}', [ - 'as' => 'playground.matrix.resource.tags.patch', + 'as' => 'playground.matrix.resource.tags.patch', 'uses' => 'TagController@update', ])->whereUuid('tag')->can('update', 'tag'); }); diff --git a/routes/teams.php b/routes/teams.php index 437ef49..7ba5f06 100644 --- a/routes/teams.php +++ b/routes/teams.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/teams', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.teams', + 'as' => 'playground.matrix.resource.teams', 'uses' => 'TeamController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Team::class); + ])->can('index', Playground\Matrix\Models\Team::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.teams.create', + 'as' => 'playground.matrix.resource.teams.create', 'uses' => 'TeamController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Team::class); + ])->can('create', Playground\Matrix\Models\Team::class); Route::get('/edit/{team}', [ - 'as' => 'playground.matrix.resource.teams.edit', + 'as' => 'playground.matrix.resource.teams.edit', 'uses' => 'TeamController@edit', ])->whereUuid('team') - ->can('edit', 'team') - ; + ->can('edit', 'team'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.teams.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{team}', [ - 'as' => 'playground.matrix.resource.teams.show', + 'as' => 'playground.matrix.resource.teams.show', 'uses' => 'TeamController@show', ])->whereUuid('team') - ->can('detail', 'team') - ; + ->can('detail', 'team'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.teams.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.teams.store', // 'uses' => 'TeamController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Team::class); + // ])->can('store', \Playground\Matrix\Models\Team::class); - # API + // API Route::put('/lock/{team}', [ - 'as' => 'playground.matrix.resource.teams.lock', + 'as' => 'playground.matrix.resource.teams.lock', 'uses' => 'TeamController@lock', ])->whereUuid('team') - ->can('lock', 'team') - ; + ->can('lock', 'team'); Route::delete('/lock/{team}', [ - 'as' => 'playground.matrix.resource.teams.unlock', + 'as' => 'playground.matrix.resource.teams.unlock', 'uses' => 'TeamController@unlock', ])->whereUuid('team') - ->can('unlock', 'team') - ; + ->can('unlock', 'team'); Route::delete('/{team}', [ - 'as' => 'playground.matrix.resource.teams.destroy', + 'as' => 'playground.matrix.resource.teams.destroy', 'uses' => 'TeamController@destroy', ])->whereUuid('team') ->can('delete', 'team') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{team}', [ - 'as' => 'playground.matrix.resource.teams.restore', + 'as' => 'playground.matrix.resource.teams.restore', 'uses' => 'TeamController@restore', ])->whereUuid('team') ->can('restore', 'team') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.teams.post', + 'as' => 'playground.matrix.resource.teams.post', 'uses' => 'TeamController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Team::class); + ])->can('store', Playground\Matrix\Models\Team::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.teams.put', // 'uses' => 'TeamController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Team::class); + // ])->can('store', \Playground\Matrix\Models\Team::class); // // Route::put('/{team}', [ // 'as' => 'playground.matrix.resource.teams.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('team')->can('update', 'team'); Route::patch('/{team}', [ - 'as' => 'playground.matrix.resource.teams.patch', + 'as' => 'playground.matrix.resource.teams.patch', 'uses' => 'TeamController@update', ])->whereUuid('team')->can('update', 'team'); }); diff --git a/routes/tickets.php b/routes/tickets.php index ce76b39..17b3eb7 100644 --- a/routes/tickets.php +++ b/routes/tickets.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/tickets', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.tickets', + 'as' => 'playground.matrix.resource.tickets', 'uses' => 'TicketController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Ticket::class); + ])->can('index', Playground\Matrix\Models\Ticket::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.tickets.create', + 'as' => 'playground.matrix.resource.tickets.create', 'uses' => 'TicketController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Ticket::class); + ])->can('create', Playground\Matrix\Models\Ticket::class); Route::get('/edit/{ticket}', [ - 'as' => 'playground.matrix.resource.tickets.edit', + 'as' => 'playground.matrix.resource.tickets.edit', 'uses' => 'TicketController@edit', ])->whereUuid('ticket') - ->can('edit', 'ticket') - ; + ->can('edit', 'ticket'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.tickets.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{ticket}', [ - 'as' => 'playground.matrix.resource.tickets.show', + 'as' => 'playground.matrix.resource.tickets.show', 'uses' => 'TicketController@show', ])->whereUuid('ticket') - ->can('detail', 'ticket') - ; + ->can('detail', 'ticket'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.tickets.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.tickets.store', // 'uses' => 'TicketController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Ticket::class); + // ])->can('store', \Playground\Matrix\Models\Ticket::class); - # API + // API Route::put('/lock/{ticket}', [ - 'as' => 'playground.matrix.resource.tickets.lock', + 'as' => 'playground.matrix.resource.tickets.lock', 'uses' => 'TicketController@lock', ])->whereUuid('ticket') - ->can('lock', 'ticket') - ; + ->can('lock', 'ticket'); Route::delete('/lock/{ticket}', [ - 'as' => 'playground.matrix.resource.tickets.unlock', + 'as' => 'playground.matrix.resource.tickets.unlock', 'uses' => 'TicketController@unlock', ])->whereUuid('ticket') - ->can('unlock', 'ticket') - ; + ->can('unlock', 'ticket'); Route::delete('/{ticket}', [ - 'as' => 'playground.matrix.resource.tickets.destroy', + 'as' => 'playground.matrix.resource.tickets.destroy', 'uses' => 'TicketController@destroy', ])->whereUuid('ticket') ->can('delete', 'ticket') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{ticket}', [ - 'as' => 'playground.matrix.resource.tickets.restore', + 'as' => 'playground.matrix.resource.tickets.restore', 'uses' => 'TicketController@restore', ])->whereUuid('ticket') ->can('restore', 'ticket') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.tickets.post', + 'as' => 'playground.matrix.resource.tickets.post', 'uses' => 'TicketController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Ticket::class); + ])->can('store', Playground\Matrix\Models\Ticket::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.tickets.put', // 'uses' => 'TicketController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Ticket::class); + // ])->can('store', \Playground\Matrix\Models\Ticket::class); // // Route::put('/{ticket}', [ // 'as' => 'playground.matrix.resource.tickets.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('ticket')->can('update', 'ticket'); Route::patch('/{ticket}', [ - 'as' => 'playground.matrix.resource.tickets.patch', + 'as' => 'playground.matrix.resource.tickets.patch', 'uses' => 'TicketController@update', ])->whereUuid('ticket')->can('update', 'ticket'); }); diff --git a/routes/versions.php b/routes/versions.php index cb8677b..2d8419f 100644 --- a/routes/versions.php +++ b/routes/versions.php @@ -13,26 +13,25 @@ Route::group([ 'prefix' => 'resource/matrix/versions', 'middleware' => config('playground-matrix-resource.middleware'), - 'namespace' => '\GammaMatrix\Playground\Matrix\Resource\Http\Controllers', + 'namespace' => '\Playground\Matrix\Resource\Http\Controllers', ], function () { Route::get('/', [ - 'as' => 'playground.matrix.resource.versions', + 'as' => 'playground.matrix.resource.versions', 'uses' => 'VersionController@index', - ])->can('index', \GammaMatrix\Playground\Matrix\Models\Version::class); + ])->can('index', Playground\Matrix\Models\Version::class); - # UI + // UI Route::get('/create', [ - 'as' => 'playground.matrix.resource.versions.create', + 'as' => 'playground.matrix.resource.versions.create', 'uses' => 'VersionController@create', - ])->can('create', \GammaMatrix\Playground\Matrix\Models\Version::class); + ])->can('create', Playground\Matrix\Models\Version::class); Route::get('/edit/{version}', [ - 'as' => 'playground.matrix.resource.versions.edit', + 'as' => 'playground.matrix.resource.versions.edit', 'uses' => 'VersionController@edit', ])->whereUuid('version') - ->can('edit', 'version') - ; + ->can('edit', 'version'); // Route::get('/go/{id}', [ // 'as' => 'playground.matrix.resource.versions.go', @@ -40,11 +39,10 @@ // ]); Route::get('/{version}', [ - 'as' => 'playground.matrix.resource.versions.show', + 'as' => 'playground.matrix.resource.versions.show', 'uses' => 'VersionController@show', ])->whereUuid('version') - ->can('detail', 'version') - ; + ->can('detail', 'version'); // Route::get('/{slug}', [ // 'as' => 'playground.matrix.resource.versions.slug', @@ -54,49 +52,45 @@ // Route::post('/store', [ // 'as' => 'playground.matrix.resource.versions.store', // 'uses' => 'VersionController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Version::class); + // ])->can('store', \Playground\Matrix\Models\Version::class); - # API + // API Route::put('/lock/{version}', [ - 'as' => 'playground.matrix.resource.versions.lock', + 'as' => 'playground.matrix.resource.versions.lock', 'uses' => 'VersionController@lock', ])->whereUuid('version') - ->can('lock', 'version') - ; + ->can('lock', 'version'); Route::delete('/lock/{version}', [ - 'as' => 'playground.matrix.resource.versions.unlock', + 'as' => 'playground.matrix.resource.versions.unlock', 'uses' => 'VersionController@unlock', ])->whereUuid('version') - ->can('unlock', 'version') - ; + ->can('unlock', 'version'); Route::delete('/{version}', [ - 'as' => 'playground.matrix.resource.versions.destroy', + 'as' => 'playground.matrix.resource.versions.destroy', 'uses' => 'VersionController@destroy', ])->whereUuid('version') ->can('delete', 'version') - ->withTrashed() - ; + ->withTrashed(); Route::put('/restore/{version}', [ - 'as' => 'playground.matrix.resource.versions.restore', + 'as' => 'playground.matrix.resource.versions.restore', 'uses' => 'VersionController@restore', ])->whereUuid('version') ->can('restore', 'version') - ->withTrashed() - ; + ->withTrashed(); Route::post('/', [ - 'as' => 'playground.matrix.resource.versions.post', + 'as' => 'playground.matrix.resource.versions.post', 'uses' => 'VersionController@store', - ])->can('store', \GammaMatrix\Playground\Matrix\Models\Version::class); + ])->can('store', Playground\Matrix\Models\Version::class); // Route::put('/', [ // 'as' => 'playground.matrix.resource.versions.put', // 'uses' => 'VersionController@store', - // ])->can('store', \GammaMatrix\Playground\Matrix\Models\Version::class); + // ])->can('store', \Playground\Matrix\Models\Version::class); // // Route::put('/{version}', [ // 'as' => 'playground.matrix.resource.versions.put.id', @@ -104,7 +98,7 @@ // ])->whereUuid('version')->can('update', 'version'); Route::patch('/{version}', [ - 'as' => 'playground.matrix.resource.versions.patch', + 'as' => 'playground.matrix.resource.versions.patch', 'uses' => 'VersionController@update', ])->whereUuid('version')->can('update', 'version'); }); diff --git a/src/Http/Controllers/BacklogController.php b/src/Http/Controllers/BacklogController.php index 4b4dd5b..01eaacb 100644 --- a/src/Http/Controllers/BacklogController.php +++ b/src/Http/Controllers/BacklogController.php @@ -1,60 +1,61 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Backlog', - 'model_label_plural' => 'Backlogs', - 'model_route' => 'playground.matrix.resource.backlogs', - 'model_slug' => 'backlog', - 'model_slug_plural' => 'backlogs', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Backlog', + 'model_label_plural' => 'Backlogs', + 'model_route' => 'playground.matrix.resource.backlogs', + 'model_slug' => 'backlog', + 'model_slug_plural' => 'backlogs', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:backlog', - 'table' => 'matrix_backlogs', - 'view' => 'playground-matrix-resource::backlog', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:backlog', + 'table' => 'matrix_backlogs', + 'view' => 'playground-matrix-resource::backlog', ]; /** * CREATE the Backlog resource in storage. * - * @route GET /resource/matrix/backlogs/create playground.matrix.resource.backlogs.create + * @route GET /resource/matrix/backl*ogs/create playground.matrix.resource.backlogs.create */ public function create( CreateRequest $request ): JsonResponse|View { + $validated = $request->validated(); $user = $request->user(); @@ -63,10 +64,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -84,19 +85,16 @@ public function create( $flash = $backlog->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } - return view( - 'playground-matrix-resource::backlog/form', - $data - ); + return view($this->getViewPath('backlog', 'form'), $data); } /** @@ -114,10 +112,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $backlog->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $backlog->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -135,7 +133,7 @@ public function edit( $flash = $backlog->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -171,7 +169,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -191,15 +189,15 @@ public function lock( $user = $request->user(); - $backlog->locked = true; + $backlog->setAttribute('locked', true); $backlog->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $backlog->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $backlog->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; // dump($request); @@ -209,7 +207,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +230,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +254,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +265,15 @@ public function index( $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, + '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 = [ @@ -309,7 +308,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +330,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $backlog->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $backlog->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +355,10 @@ public function show( } /** - * Store a newly created API Backlog resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.backlogs.post - */ + * Store a newly created API Backlog resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.backlogs.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|BacklogResource { @@ -377,7 +376,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +396,7 @@ public function unlock( $user = $request->user(); - $backlog->locked = false; + $backlog->setAttribute('locked', false); $backlog->save(); @@ -407,7 +406,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +434,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/BoardController.php b/src/Http/Controllers/BoardController.php index be4a198..92dd7f4 100644 --- a/src/Http/Controllers/BoardController.php +++ b/src/Http/Controllers/BoardController.php @@ -1,51 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Board', - 'model_label_plural' => 'Boards', - 'model_route' => 'playground.matrix.resource.boards', - 'model_slug' => 'board', - 'model_slug_plural' => 'boards', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Board', + 'model_label_plural' => 'Boards', + 'model_route' => 'playground.matrix.resource.boards', + 'model_slug' => 'board', + 'model_slug_plural' => 'boards', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:board', - 'table' => 'matrix_boards', - 'view' => 'playground-matrix-resource::board', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:board', + 'table' => 'matrix_boards', + 'view' => 'playground-matrix-resource::board', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $board->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $board->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $board->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $board->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $board->locked = true; + $board->setAttribute('locked', true); $board->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $board->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $board->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $board->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $board->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Board resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.boards.post - */ + * Store a newly created API Board resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.boards.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|BoardResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $board->locked = false; + $board->setAttribute('locked', false); $board->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/Controller.php b/src/Http/Controllers/Controller.php new file mode 100644 index 0000000..ede4f54 --- /dev/null +++ b/src/Http/Controllers/Controller.php @@ -0,0 +1,35 @@ + + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Epic', - 'model_label_plural' => 'Epics', - 'model_route' => 'playground.matrix.resource.epics', - 'model_slug' => 'epic', - 'model_slug_plural' => 'epics', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Epic', + 'model_label_plural' => 'Epics', + 'model_route' => 'playground.matrix.resource.epics', + 'model_slug' => 'epic', + 'model_slug_plural' => 'epics', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:epic', - 'table' => 'matrix_epics', - 'view' => 'playground-matrix-resource::epic', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:epic', + 'table' => 'matrix_epics', + 'view' => 'playground-matrix-resource::epic', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $epic->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $epic->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $epic->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $epic->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $epic->locked = true; + $epic->setAttribute('locked', true); $epic->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $epic->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $epic->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $epic->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $epic->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Epic resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.epics.post - */ + * Store a newly created API Epic resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.epics.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|EpicResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $epic->locked = false; + $epic->setAttribute('locked', false); $epic->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/FlowController.php b/src/Http/Controllers/FlowController.php index a542a2a..1eddfbb 100644 --- a/src/Http/Controllers/FlowController.php +++ b/src/Http/Controllers/FlowController.php @@ -1,51 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Flow', - 'model_label_plural' => 'Flows', - 'model_route' => 'playground.matrix.resource.flows', - 'model_slug' => 'flow', - 'model_slug_plural' => 'flows', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Flow', + 'model_label_plural' => 'Flows', + 'model_route' => 'playground.matrix.resource.flows', + 'model_slug' => 'flow', + 'model_slug_plural' => 'flows', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:flow', - 'table' => 'matrix_flows', - 'view' => 'playground-matrix-resource::flow', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:flow', + 'table' => 'matrix_flows', + 'view' => 'playground-matrix-resource::flow', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $flow->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $flow->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $flow->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $flow->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $flow->locked = true; + $flow->setAttribute('locked', true); $flow->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $flow->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $flow->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $flow->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $flow->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Flow resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.flows.post - */ + * Store a newly created API Flow resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.flows.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|FlowResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $flow->locked = false; + $flow->setAttribute('locked', false); $flow->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/IndexController.php b/src/Http/Controllers/IndexController.php index dbf827d..177fa49 100644 --- a/src/Http/Controllers/IndexController.php +++ b/src/Http/Controllers/IndexController.php @@ -1,25 +1,20 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Milestone', - 'model_label_plural' => 'Milestones', - 'model_route' => 'playground.matrix.resource.milestones', - 'model_slug' => 'milestone', - 'model_slug_plural' => 'milestones', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Milestone', + 'model_label_plural' => 'Milestones', + 'model_route' => 'playground.matrix.resource.milestones', + 'model_slug' => 'milestone', + 'model_slug_plural' => 'milestones', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:milestone', - 'table' => 'matrix_milestones', - 'view' => 'playground-matrix-resource::milestone', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:milestone', + 'table' => 'matrix_milestones', + 'view' => 'playground-matrix-resource::milestone', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $milestone->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $milestone->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $milestone->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $milestone->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $milestone->locked = true; + $milestone->setAttribute('locked', true); $milestone->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $milestone->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $milestone->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $milestone->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $milestone->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Milestone resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.milestones.post - */ + * Store a newly created API Milestone resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.milestones.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|MilestoneResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $milestone->locked = false; + $milestone->setAttribute('locked', false); $milestone->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/NoteController.php b/src/Http/Controllers/NoteController.php index 827a17b..6354267 100644 --- a/src/Http/Controllers/NoteController.php +++ b/src/Http/Controllers/NoteController.php @@ -1,51 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Note', - 'model_label_plural' => 'Notes', - 'model_route' => 'playground.matrix.resource.notes', - 'model_slug' => 'note', - 'model_slug_plural' => 'notes', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Note', + 'model_label_plural' => 'Notes', + 'model_route' => 'playground.matrix.resource.notes', + 'model_slug' => 'note', + 'model_slug_plural' => 'notes', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:note', - 'table' => 'matrix_notes', - 'view' => 'playground-matrix-resource::note', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:note', + 'table' => 'matrix_notes', + 'view' => 'playground-matrix-resource::note', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $note->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $note->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $note->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $note->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $note->locked = true; + $note->setAttribute('locked', true); $note->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $note->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $note->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $note->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $note->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Note resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.notes.post - */ + * Store a newly created API Note resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.notes.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|NoteResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $note->locked = false; + $note->setAttribute('locked', false); $note->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/ProjectController.php b/src/Http/Controllers/ProjectController.php index 55884d4..1fa6271 100644 --- a/src/Http/Controllers/ProjectController.php +++ b/src/Http/Controllers/ProjectController.php @@ -1,51 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Project', - 'model_label_plural' => 'Projects', - 'model_route' => 'playground.matrix.resource.projects', - 'model_slug' => 'project', - 'model_slug_plural' => 'projects', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Project', + 'model_label_plural' => 'Projects', + 'model_route' => 'playground.matrix.resource.projects', + 'model_slug' => 'project', + 'model_slug_plural' => 'projects', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:project', - 'table' => 'matrix_projects', - 'view' => 'playground-matrix-resource::project', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:project', + 'table' => 'matrix_projects', + 'view' => 'playground-matrix-resource::project', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $project->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $project->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $project->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $project->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $project->locked = true; + $project->setAttribute('locked', true); $project->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $project->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $project->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $project->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $project->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Project resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.projects.post - */ + * Store a newly created API Project resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.projects.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|ProjectResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $project->locked = false; + $project->setAttribute('locked', false); $project->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/ReleaseController.php b/src/Http/Controllers/ReleaseController.php index fe8b703..8790930 100644 --- a/src/Http/Controllers/ReleaseController.php +++ b/src/Http/Controllers/ReleaseController.php @@ -1,51 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Release', - 'model_label_plural' => 'Releases', - 'model_route' => 'playground.matrix.resource.releases', - 'model_slug' => 'release', - 'model_slug_plural' => 'releases', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Release', + 'model_label_plural' => 'Releases', + 'model_route' => 'playground.matrix.resource.releases', + 'model_slug' => 'release', + 'model_slug_plural' => 'releases', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:release', - 'table' => 'matrix_releases', - 'view' => 'playground-matrix-resource::release', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:release', + 'table' => 'matrix_releases', + 'view' => 'playground-matrix-resource::release', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $release->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $release->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $release->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $release->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $release->locked = true; + $release->setAttribute('locked', true); $release->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $release->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $release->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $release->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $release->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Release resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.releases.post - */ + * Store a newly created API Release resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.releases.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|ReleaseResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $release->locked = false; + $release->setAttribute('locked', false); $release->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/RoadmapController.php b/src/Http/Controllers/RoadmapController.php index e382d05..f5acbea 100644 --- a/src/Http/Controllers/RoadmapController.php +++ b/src/Http/Controllers/RoadmapController.php @@ -1,51 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Roadmap', - 'model_label_plural' => 'Roadmaps', - 'model_route' => 'playground.matrix.resource.roadmaps', - 'model_slug' => 'roadmap', - 'model_slug_plural' => 'roadmaps', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Roadmap', + 'model_label_plural' => 'Roadmaps', + 'model_route' => 'playground.matrix.resource.roadmaps', + 'model_slug' => 'roadmap', + 'model_slug_plural' => 'roadmaps', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:roadmap', - 'table' => 'matrix_roadmaps', - 'view' => 'playground-matrix-resource::roadmap', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:roadmap', + 'table' => 'matrix_roadmaps', + 'view' => 'playground-matrix-resource::roadmap', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $roadmap->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $roadmap->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $roadmap->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $roadmap->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $roadmap->locked = true; + $roadmap->setAttribute('locked', true); $roadmap->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $roadmap->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $roadmap->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $roadmap->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $roadmap->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Roadmap resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.roadmaps.post - */ + * Store a newly created API Roadmap resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.roadmaps.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|RoadmapResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $roadmap->locked = false; + $roadmap->setAttribute('locked', false); $roadmap->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/SourceController.php b/src/Http/Controllers/SourceController.php index a0f9be3..0dbbdc4 100644 --- a/src/Http/Controllers/SourceController.php +++ b/src/Http/Controllers/SourceController.php @@ -1,51 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Source', - 'model_label_plural' => 'Sources', - 'model_route' => 'playground.matrix.resource.sources', - 'model_slug' => 'source', - 'model_slug_plural' => 'sources', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Source', + 'model_label_plural' => 'Sources', + 'model_route' => 'playground.matrix.resource.sources', + 'model_slug' => 'source', + 'model_slug_plural' => 'sources', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:source', - 'table' => 'matrix_sources', - 'view' => 'playground-matrix-resource::source', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:source', + 'table' => 'matrix_sources', + 'view' => 'playground-matrix-resource::source', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $source->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $source->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $source->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $source->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $source->locked = true; + $source->setAttribute('locked', true); $source->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $source->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $source->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $source->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $source->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Source resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.sources.post - */ + * Store a newly created API Source resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.sources.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|SourceResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $source->locked = false; + $source->setAttribute('locked', false); $source->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/SprintController.php b/src/Http/Controllers/SprintController.php index 0b99a07..4685ffe 100644 --- a/src/Http/Controllers/SprintController.php +++ b/src/Http/Controllers/SprintController.php @@ -1,51 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Sprint', - 'model_label_plural' => 'Sprints', - 'model_route' => 'playground.matrix.resource.sprints', - 'model_slug' => 'sprint', - 'model_slug_plural' => 'sprints', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Sprint', + 'model_label_plural' => 'Sprints', + 'model_route' => 'playground.matrix.resource.sprints', + 'model_slug' => 'sprint', + 'model_slug_plural' => 'sprints', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:sprint', - 'table' => 'matrix_sprints', - 'view' => 'playground-matrix-resource::sprint', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:sprint', + 'table' => 'matrix_sprints', + 'view' => 'playground-matrix-resource::sprint', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $sprint->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $sprint->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $sprint->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $sprint->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $sprint->locked = true; + $sprint->setAttribute('locked', true); $sprint->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $sprint->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $sprint->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $sprint->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $sprint->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Sprint resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.sprints.post - */ + * Store a newly created API Sprint resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.sprints.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|SprintResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $sprint->locked = false; + $sprint->setAttribute('locked', false); $sprint->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/TagController.php b/src/Http/Controllers/TagController.php index 7948086..82b99e8 100644 --- a/src/Http/Controllers/TagController.php +++ b/src/Http/Controllers/TagController.php @@ -1,51 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Tag', - 'model_label_plural' => 'Tags', - 'model_route' => 'playground.matrix.resource.tags', - 'model_slug' => 'tag', - 'model_slug_plural' => 'tags', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Tag', + 'model_label_plural' => 'Tags', + 'model_route' => 'playground.matrix.resource.tags', + 'model_slug' => 'tag', + 'model_slug_plural' => 'tags', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:tag', - 'table' => 'matrix_tags', - 'view' => 'playground-matrix-resource::tag', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:tag', + 'table' => 'matrix_tags', + 'view' => 'playground-matrix-resource::tag', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $tag->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $tag->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $tag->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $tag->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $tag->locked = true; + $tag->setAttribute('locked', true); $tag->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $tag->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $tag->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $tag->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $tag->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Tag resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.tags.post - */ + * Store a newly created API Tag resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.tags.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|TagResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $tag->locked = false; + $tag->setAttribute('locked', false); $tag->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/TeamController.php b/src/Http/Controllers/TeamController.php index 28c14af..58be30a 100644 --- a/src/Http/Controllers/TeamController.php +++ b/src/Http/Controllers/TeamController.php @@ -1,51 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Team', - 'model_label_plural' => 'Teams', - 'model_route' => 'playground.matrix.resource.teams', - 'model_slug' => 'team', - 'model_slug_plural' => 'teams', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Team', + 'model_label_plural' => 'Teams', + 'model_route' => 'playground.matrix.resource.teams', + 'model_slug' => 'team', + 'model_slug_plural' => 'teams', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:team', - 'table' => 'matrix_teams', - 'view' => 'playground-matrix-resource::team', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:team', + 'table' => 'matrix_teams', + 'view' => 'playground-matrix-resource::team', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $team->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $team->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $team->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $team->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $team->locked = true; + $team->setAttribute('locked', true); $team->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $team->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $team->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $team->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $team->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Team resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.teams.post - */ + * Store a newly created API Team resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.teams.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|TeamResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $team->locked = false; + $team->setAttribute('locked', false); $team->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/TicketController.php b/src/Http/Controllers/TicketController.php index 3bd1288..281b4ed 100644 --- a/src/Http/Controllers/TicketController.php +++ b/src/Http/Controllers/TicketController.php @@ -1,51 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Ticket', - 'model_label_plural' => 'Tickets', - 'model_route' => 'playground.matrix.resource.tickets', - 'model_slug' => 'ticket', - 'model_slug_plural' => 'tickets', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Ticket', + 'model_label_plural' => 'Tickets', + 'model_route' => 'playground.matrix.resource.tickets', + 'model_slug' => 'ticket', + 'model_slug_plural' => 'tickets', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:ticket', - 'table' => 'matrix_tickets', - 'view' => 'playground-matrix-resource::ticket', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:ticket', + 'table' => 'matrix_tickets', + 'view' => 'playground-matrix-resource::ticket', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $ticket->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $ticket->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $ticket->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $ticket->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $ticket->locked = true; + $ticket->setAttribute('locked', true); $ticket->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $ticket->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $ticket->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $ticket->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $ticket->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Ticket resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.tickets.post - */ + * Store a newly created API Ticket resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.tickets.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|TicketResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $ticket->locked = false; + $ticket->setAttribute('locked', false); $ticket->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Controllers/VersionController.php b/src/Http/Controllers/VersionController.php index 35c2bef..b1dd6f0 100644 --- a/src/Http/Controllers/VersionController.php +++ b/src/Http/Controllers/VersionController.php @@ -1,51 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Version', - 'model_label_plural' => 'Versions', - 'model_route' => 'playground.matrix.resource.versions', - 'model_slug' => 'version', - 'model_slug_plural' => 'versions', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Version', + 'model_label_plural' => 'Versions', + 'model_route' => 'playground.matrix.resource.versions', + 'model_slug' => 'version', + 'model_slug_plural' => 'versions', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:version', - 'table' => 'matrix_versions', - 'view' => 'playground-matrix-resource::version', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:version', + 'table' => 'matrix_versions', + 'view' => 'playground-matrix-resource::version', ]; /** @@ -64,10 +63,10 @@ public function create( $meta = [ 'session_user_id' => $user?->id, - 'id' => null, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => null, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -85,12 +84,12 @@ public function create( $flash = $version->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } - if (!$request->session()->has('errors')) { + if (! $request->session()->has('errors')) { session()->flashInput($flash); } @@ -115,10 +114,10 @@ public function edit( $meta = [ 'session_user_id' => $user?->id, - 'id' => $version->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $version->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; $meta['input'] = $request->input(); @@ -136,7 +135,7 @@ public function edit( $flash = $version->toArray(); - if (!empty($validated['_return_url'])) { + if (! empty($validated['_return_url'])) { $flash['_return_url'] = $validated['_return_url']; $data['_return_url'] = $validated['_return_url']; } @@ -172,7 +171,7 @@ public function destroy( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -192,15 +191,15 @@ public function lock( $user = $request->user(); - $version->locked = true; + $version->setAttribute('locked', true); $version->save(); $meta = [ 'session_user_id' => $user?->id, - 'id' => $version->id, - 'timestamp' => Carbon::now()->toJson(), - 'info' => $this->packageInfo, + 'id' => $version->id, + 'timestamp' => Carbon::now()->toJson(), + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -209,7 +208,7 @@ public function lock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -232,7 +231,7 @@ public function index( $query->sort($validated['sort'] ?? null); - if (!empty($validated['filter']) && is_array($validated['filter'])) { + if (! empty($validated['filter']) && is_array($validated['filter'])) { $query->filterTrash($validated['filter']['trash'] ?? null); $query->filterIds( @@ -256,7 +255,8 @@ public function index( ); } - $paginator = $query->paginate($validated['perPage'] ?? null); + $perPage = ! empty($validated['perPage']) && is_int($validated['perPage']) ? $validated['perPage'] : null; + $paginator = $query->paginate( $perPage); $paginator->appends($validated); @@ -266,15 +266,15 @@ public function index( $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, + '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 = [ @@ -309,7 +309,7 @@ public function restore( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -331,10 +331,10 @@ public function show( $meta = [ 'session_user_id' => $user?->id, - 'id' => $version->id, - 'timestamp' => Carbon::now()->toJson(), - 'validated' => $validated, - 'info' => $this->packageInfo, + 'id' => $version->id, + 'timestamp' => Carbon::now()->toJson(), + 'validated' => $validated, + 'info' => $this->packageInfo, ]; if ($request->expectsJson()) { @@ -356,10 +356,10 @@ public function show( } /** - * Store a newly created API Version resource in storage. - * - * @route POST /resource/matrix playground.matrix.resource.versions.post - */ + * Store a newly created API Version resource in storage. + * + * @route POST /resource/matrix playground.matrix.resource.versions.post + */ public function store( StoreRequest $request ): Response|JsonResponse|RedirectResponse|VersionResource { @@ -377,7 +377,7 @@ public function store( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -397,7 +397,7 @@ public function unlock( $user = $request->user(); - $version->locked = false; + $version->setAttribute('locked', false); $version->save(); @@ -407,7 +407,7 @@ public function unlock( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } @@ -435,7 +435,7 @@ public function update( $returnUrl = $validated['_return_url'] ?? ''; - if ($returnUrl) { + if ($returnUrl && is_string($returnUrl)) { return redirect($returnUrl); } diff --git a/src/Http/Requests/AbstractIndexRequest.php b/src/Http/Requests/AbstractIndexRequest.php deleted file mode 100644 index ee1527b..0000000 --- a/src/Http/Requests/AbstractIndexRequest.php +++ /dev/null @@ -1,165 +0,0 @@ - [ - 'nullable', - 'integer', - ], - 'page' => [ - 'nullable', - 'integer', - ], - 'sort' => [ - 'nullable', - ], - 'filter' => [ - 'nullable', - 'array', - ], - // Trashed - 'filter.trash' => [ - 'nullable', - 'in:hide,with,only', - ], - ]; - - public function getPaginationOperators(): array - { - return [ - '|' => [], - '&' => [], - '=' => [], - '!=' => [], - '<>' => [], - '<=>' => [], - '<' => [], - '<=' => [], - '>=' => [], - 'NULL' => [], - 'NOTNULL' => [], - 'LIKE' => [], - 'NOTLIKE' => [], - 'BETWEEN' => [], - 'NOTBETWEEN' => [], - ]; - } - - public function rules(): array - { - $rules = parent::rules(); - - $this->rules_filters($rules); - // dump([ - // '__METHOD__' => __METHOD__, - // '__FILE__' => __FILE__, - // '__LINE__' => __LINE__, - // '$rules' => $rules, - // ]); - - // \Log::debug(__METHOD__, [ - // '$action' => $action, - // '$rules' => $rules, - // ]); - return $rules; - } - - public function rules_filters(array &$rules): void - { - if (method_exists($this, 'rules_filters_flags')) { - $this->rules_filters_flags($rules); - } - if (method_exists($this, 'rules_filters_dates')) { - $this->rules_filters_dates($rules); - } - if (method_exists($this, 'rules_filters_ids')) { - $this->rules_filters_ids($rules); - } - if (method_exists($this, 'rules_filters_columns')) { - $this->rules_filters_columns($rules); - } - } - - /** - * Prepare the data for validation. - * - * @return void - */ - protected function prepareForValidation() - { - // dump([ - // '__METHOD__' => __METHOD__, - // '__FILE__' => __FILE__, - // '__LINE__' => __LINE__, - // '$this->input()' => $this->input(), - // ]); - - $this->prepareForValidationPagination(); - - if (method_exists($this, 'prepareForValidationForDates')) { - $this->prepareForValidationForDates(); - } - - if (method_exists($this, 'prepareForValidationSort')) { - $this->prepareForValidationSort(); - } - } - - /** - * Handle a passed validation attempt. - * - * @return void - */ - protected function passedValidation() - { - // NOTE sort could be converted back to a string - } - - public function prepareForValidationPagination(): array - { - $page = $this->get('page'); - $page = is_numeric($page) ? (int) abs($page) : null; - $perPage = $this->get('perPage'); - $perPage = is_numeric($perPage) ? (int) abs($perPage) : $this->perPage; - $perPage = $perPage > $this->perPageMax ? $this->perPageMax : $perPage; - - $this->merge([ - 'page' => $page, - 'perPage' => $perPage, - ]); - - return [ - 'page' => $page, - 'perPage' => $perPage, - ]; - } -} diff --git a/src/Http/Requests/AbstractStoreRequest.php b/src/Http/Requests/AbstractStoreRequest.php deleted file mode 100644 index 2de82ea..0000000 --- a/src/Http/Requests/AbstractStoreRequest.php +++ /dev/null @@ -1,57 +0,0 @@ - 'The :attribute has already been taken: :input', - 'slug.unique' => __('playground::validation.slug.unique'), - ]; - } - - public function rules(): array - { - $rules = parent::rules(); - - if (method_exists($this, 'rules_store_slug_create')) { - $this->rules_store_slug_create($rules); - } - // dump([ - // '__METHOD__' => __METHOD__, - // '__FILE__' => __FILE__, - // '__LINE__' => __LINE__, - // '$rules' => $rules, - // ]); - - // \Log::debug(__METHOD__, [ - // '$action' => $action, - // '$rules' => $rules, - // ]); - return $rules; - } - - /** - * Prepare the data for validation. - * - * @return void - */ - protected function prepareForValidation() - { - if (method_exists($this, 'prepareForValidationForSlug')) { - $this->prepareForValidationForSlug(); - } - } -} diff --git a/src/Http/Requests/AbstractUpdateRequest.php b/src/Http/Requests/AbstractUpdateRequest.php deleted file mode 100644 index f937cb9..0000000 --- a/src/Http/Requests/AbstractUpdateRequest.php +++ /dev/null @@ -1,63 +0,0 @@ - 'The :attribute has already been taken: :input', - 'slug.unique' => __('playground::validation.slug.unique'), - ]; - } - - public function rules(): array - { - $rules = parent::rules(); - - if (method_exists($this, 'rules_store_slug_update')) { - $this->rules_store_slug_update($rules); - } - // dump([ - // '__METHOD__' => __METHOD__, - // '__FILE__' => __FILE__, - // '__LINE__' => __LINE__, - // '$rules' => $rules, - // ]); - - // \Log::debug(__METHOD__, [ - // '$action' => $action, - // '$rules' => $rules, - // ]); - return $rules; - } - - /** - * Prepare the data for validation. - * - * @return void - */ - protected function prepareForValidation() - { - if (method_exists($this, 'prepareForValidationForSlug')) { - $this->prepareForValidationForSlug(); - } - // dd([ - // '__METHOD__' => __METHOD__, - // '__FILE__' => __FILE__, - // '__LINE__' => __LINE__, - // 'method_exists' => method_exists($this, 'prepareForValidationForSlug'), - // ]); - } -} diff --git a/src/Http/Requests/Backlog/CreateRequest.php b/src/Http/Requests/Backlog/CreateRequest.php index 132420c..831fc23 100644 --- a/src/Http/Requests/Backlog/CreateRequest.php +++ b/src/Http/Requests/Backlog/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Backlog/DestroyRequest.php b/src/Http/Requests/Backlog/DestroyRequest.php index eb51ebc..ff036b7 100644 --- a/src/Http/Requests/Backlog/DestroyRequest.php +++ b/src/Http/Requests/Backlog/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Backlog/EditRequest.php b/src/Http/Requests/Backlog/EditRequest.php index 5454425..8e04371 100644 --- a/src/Http/Requests/Backlog/EditRequest.php +++ b/src/Http/Requests/Backlog/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Backlog/IndexRequest.php b/src/Http/Requests/Backlog/IndexRequest.php index 0e072b2..bf33442 100644 --- a/src/Http/Requests/Backlog/IndexRequest.php +++ b/src/Http/Requests/Backlog/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => true], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => true], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -53,6 +58,9 @@ class IndexRequest extends AbstractIndexRequest 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], ]; + /** + * @var array + */ protected array $paginationIds = [ 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created By Id', 'type' => 'uuid', 'nullable' => true], @@ -76,6 +84,9 @@ class IndexRequest extends AbstractIndexRequest 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => true], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => false], @@ -88,6 +99,9 @@ class IndexRequest extends AbstractIndexRequest 'summary' => ['column' => 'summary', 'label' => 'Summary', 'type' => 'mediumText', 'nullable' => true], ]; + /** + * @var array + */ protected array $sortable = [ 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'string'], 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created By Id', 'type' => 'string'], diff --git a/src/Http/Requests/Backlog/LockRequest.php b/src/Http/Requests/Backlog/LockRequest.php index a5dfe3e..2a38653 100644 --- a/src/Http/Requests/Backlog/LockRequest.php +++ b/src/Http/Requests/Backlog/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Backlog/RestoreRequest.php b/src/Http/Requests/Backlog/RestoreRequest.php index f947f8c..3fce401 100644 --- a/src/Http/Requests/Backlog/RestoreRequest.php +++ b/src/Http/Requests/Backlog/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Backlog/ShowRequest.php b/src/Http/Requests/Backlog/ShowRequest.php index 6e665b1..1d4396d 100644 --- a/src/Http/Requests/Backlog/ShowRequest.php +++ b/src/Http/Requests/Backlog/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -133,7 +132,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Backlog/UnlockRequest.php b/src/Http/Requests/Backlog/UnlockRequest.php index b3762c9..be89e2c 100644 --- a/src/Http/Requests/Backlog/UnlockRequest.php +++ b/src/Http/Requests/Backlog/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Backlog/UpdateRequest.php b/src/Http/Requests/Backlog/UpdateRequest.php index c2ee34c..cc3da17 100644 --- a/src/Http/Requests/Backlog/UpdateRequest.php +++ b/src/Http/Requests/Backlog/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -133,7 +132,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Board/CreateRequest.php b/src/Http/Requests/Board/CreateRequest.php index ae812d1..5953f7e 100644 --- a/src/Http/Requests/Board/CreateRequest.php +++ b/src/Http/Requests/Board/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Board/DestroyRequest.php b/src/Http/Requests/Board/DestroyRequest.php index 19e9187..63e2f32 100644 --- a/src/Http/Requests/Board/DestroyRequest.php +++ b/src/Http/Requests/Board/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Board/EditRequest.php b/src/Http/Requests/Board/EditRequest.php index 4441c9d..c14cd28 100644 --- a/src/Http/Requests/Board/EditRequest.php +++ b/src/Http/Requests/Board/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Board/IndexRequest.php b/src/Http/Requests/Board/IndexRequest.php index 1a53659..579ca34 100644 --- a/src/Http/Requests/Board/IndexRequest.php +++ b/src/Http/Requests/Board/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -57,6 +62,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -79,6 +87,9 @@ class IndexRequest extends AbstractIndexRequest 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Board/LockRequest.php b/src/Http/Requests/Board/LockRequest.php index 5b86c45..b75d771 100644 --- a/src/Http/Requests/Board/LockRequest.php +++ b/src/Http/Requests/Board/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Board/RestoreRequest.php b/src/Http/Requests/Board/RestoreRequest.php index b54e785..8658ad5 100644 --- a/src/Http/Requests/Board/RestoreRequest.php +++ b/src/Http/Requests/Board/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Board/ShowRequest.php b/src/Http/Requests/Board/ShowRequest.php index 3b19d14..ea1a6d4 100644 --- a/src/Http/Requests/Board/ShowRequest.php +++ b/src/Http/Requests/Board/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -125,7 +124,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Board/UnlockRequest.php b/src/Http/Requests/Board/UnlockRequest.php index 210bec7..2774889 100644 --- a/src/Http/Requests/Board/UnlockRequest.php +++ b/src/Http/Requests/Board/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Board/UpdateRequest.php b/src/Http/Requests/Board/UpdateRequest.php index 8743ca5..235e48d 100644 --- a/src/Http/Requests/Board/UpdateRequest.php +++ b/src/Http/Requests/Board/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -125,7 +124,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Epic/CreateRequest.php b/src/Http/Requests/Epic/CreateRequest.php index 9b1afd0..e28f461 100644 --- a/src/Http/Requests/Epic/CreateRequest.php +++ b/src/Http/Requests/Epic/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Epic/DestroyRequest.php b/src/Http/Requests/Epic/DestroyRequest.php index c0083e7..516f552 100644 --- a/src/Http/Requests/Epic/DestroyRequest.php +++ b/src/Http/Requests/Epic/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Epic/EditRequest.php b/src/Http/Requests/Epic/EditRequest.php index 40467e5..e653392 100644 --- a/src/Http/Requests/Epic/EditRequest.php +++ b/src/Http/Requests/Epic/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Epic/IndexRequest.php b/src/Http/Requests/Epic/IndexRequest.php index 44af6cb..ebcad7f 100644 --- a/src/Http/Requests/Epic/IndexRequest.php +++ b/src/Http/Requests/Epic/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -57,6 +62,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -77,6 +85,9 @@ class IndexRequest extends AbstractIndexRequest 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Epic/LockRequest.php b/src/Http/Requests/Epic/LockRequest.php index d03d924..1216838 100644 --- a/src/Http/Requests/Epic/LockRequest.php +++ b/src/Http/Requests/Epic/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Epic/RestoreRequest.php b/src/Http/Requests/Epic/RestoreRequest.php index 3f82702..92822ca 100644 --- a/src/Http/Requests/Epic/RestoreRequest.php +++ b/src/Http/Requests/Epic/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Epic/ShowRequest.php b/src/Http/Requests/Epic/ShowRequest.php index f5cc8b8..885122d 100644 --- a/src/Http/Requests/Epic/ShowRequest.php +++ b/src/Http/Requests/Epic/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -125,7 +124,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Epic/UnlockRequest.php b/src/Http/Requests/Epic/UnlockRequest.php index e69e2d5..2bd6ad2 100644 --- a/src/Http/Requests/Epic/UnlockRequest.php +++ b/src/Http/Requests/Epic/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Epic/UpdateRequest.php b/src/Http/Requests/Epic/UpdateRequest.php index cd35be5..f7165c7 100644 --- a/src/Http/Requests/Epic/UpdateRequest.php +++ b/src/Http/Requests/Epic/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -125,7 +124,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Flow/CreateRequest.php b/src/Http/Requests/Flow/CreateRequest.php index e6ec12a..f20d0ef 100644 --- a/src/Http/Requests/Flow/CreateRequest.php +++ b/src/Http/Requests/Flow/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Flow/DestroyRequest.php b/src/Http/Requests/Flow/DestroyRequest.php index 7922376..00b00a5 100644 --- a/src/Http/Requests/Flow/DestroyRequest.php +++ b/src/Http/Requests/Flow/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Flow/EditRequest.php b/src/Http/Requests/Flow/EditRequest.php index 0f0c245..af246d4 100644 --- a/src/Http/Requests/Flow/EditRequest.php +++ b/src/Http/Requests/Flow/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Flow/IndexRequest.php b/src/Http/Requests/Flow/IndexRequest.php index 759ad89..96b01f0 100644 --- a/src/Http/Requests/Flow/IndexRequest.php +++ b/src/Http/Requests/Flow/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -30,6 +32,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -55,6 +60,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -65,6 +73,9 @@ class IndexRequest extends AbstractIndexRequest 'team_id' => ['column' => 'team_id', 'label' => 'Team Id', 'type' => 'uuid', 'nullable' => false], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Flow/LockRequest.php b/src/Http/Requests/Flow/LockRequest.php index 18968ea..e67f8f1 100644 --- a/src/Http/Requests/Flow/LockRequest.php +++ b/src/Http/Requests/Flow/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Flow/RestoreRequest.php b/src/Http/Requests/Flow/RestoreRequest.php index 0f59551..a64e4b1 100644 --- a/src/Http/Requests/Flow/RestoreRequest.php +++ b/src/Http/Requests/Flow/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Flow/ShowRequest.php b/src/Http/Requests/Flow/ShowRequest.php index 36dd97a..0e4fdac 100644 --- a/src/Http/Requests/Flow/ShowRequest.php +++ b/src/Http/Requests/Flow/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -109,7 +108,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Flow/UnlockRequest.php b/src/Http/Requests/Flow/UnlockRequest.php index 3e6243c..2a3df26 100644 --- a/src/Http/Requests/Flow/UnlockRequest.php +++ b/src/Http/Requests/Flow/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Flow/UpdateRequest.php b/src/Http/Requests/Flow/UpdateRequest.php index c039835..0e8204c 100644 --- a/src/Http/Requests/Flow/UpdateRequest.php +++ b/src/Http/Requests/Flow/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -109,7 +108,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/FormRequest.php b/src/Http/Requests/FormRequest.php index 6272e0f..9fcffee 100644 --- a/src/Http/Requests/FormRequest.php +++ b/src/Http/Requests/FormRequest.php @@ -1,18 +1,20 @@ > + */ public const RULES = []; /** @@ -33,7 +35,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array|string> */ public function rules(): array { @@ -45,7 +47,7 @@ public function rules(): array public function userHasAdminPrivileges(Authenticatable $user = null): bool { $admin = false; - if (!empty($user)) { + if (! empty($user)) { if (method_exists($user, 'isAdmin')) { $admin = $user->isAdmin(); } else { @@ -53,6 +55,7 @@ public function userHasAdminPrivileges(Authenticatable $user = null): bool $admin = true; } } + return $admin; } } diff --git a/src/Http/Requests/Milestone/CreateRequest.php b/src/Http/Requests/Milestone/CreateRequest.php index 4b80223..f13847a 100644 --- a/src/Http/Requests/Milestone/CreateRequest.php +++ b/src/Http/Requests/Milestone/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Milestone/DestroyRequest.php b/src/Http/Requests/Milestone/DestroyRequest.php index 9fba8bf..f16e8d9 100644 --- a/src/Http/Requests/Milestone/DestroyRequest.php +++ b/src/Http/Requests/Milestone/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Milestone/EditRequest.php b/src/Http/Requests/Milestone/EditRequest.php index 86a3498..4b1cd6e 100644 --- a/src/Http/Requests/Milestone/EditRequest.php +++ b/src/Http/Requests/Milestone/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Milestone/IndexRequest.php b/src/Http/Requests/Milestone/IndexRequest.php index 43a093b..c1393ba 100644 --- a/src/Http/Requests/Milestone/IndexRequest.php +++ b/src/Http/Requests/Milestone/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -57,6 +62,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -78,6 +86,9 @@ class IndexRequest extends AbstractIndexRequest 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Milestone/LockRequest.php b/src/Http/Requests/Milestone/LockRequest.php index a1adc7b..20051e2 100644 --- a/src/Http/Requests/Milestone/LockRequest.php +++ b/src/Http/Requests/Milestone/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Milestone/RestoreRequest.php b/src/Http/Requests/Milestone/RestoreRequest.php index a8a92fb..76a87be 100644 --- a/src/Http/Requests/Milestone/RestoreRequest.php +++ b/src/Http/Requests/Milestone/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Milestone/ShowRequest.php b/src/Http/Requests/Milestone/ShowRequest.php index ab6d8d4..c6021e5 100644 --- a/src/Http/Requests/Milestone/ShowRequest.php +++ b/src/Http/Requests/Milestone/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Milestone/UnlockRequest.php b/src/Http/Requests/Milestone/UnlockRequest.php index f37d527..bfd2d42 100644 --- a/src/Http/Requests/Milestone/UnlockRequest.php +++ b/src/Http/Requests/Milestone/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Milestone/UpdateRequest.php b/src/Http/Requests/Milestone/UpdateRequest.php index cb81351..1f51ee2 100644 --- a/src/Http/Requests/Milestone/UpdateRequest.php +++ b/src/Http/Requests/Milestone/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Note/CreateRequest.php b/src/Http/Requests/Note/CreateRequest.php index 1ea7dd3..f1edad0 100644 --- a/src/Http/Requests/Note/CreateRequest.php +++ b/src/Http/Requests/Note/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Note/DestroyRequest.php b/src/Http/Requests/Note/DestroyRequest.php index 16be9ac..7e34d35 100644 --- a/src/Http/Requests/Note/DestroyRequest.php +++ b/src/Http/Requests/Note/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Note/EditRequest.php b/src/Http/Requests/Note/EditRequest.php index 9844119..49abf78 100644 --- a/src/Http/Requests/Note/EditRequest.php +++ b/src/Http/Requests/Note/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Note/IndexRequest.php b/src/Http/Requests/Note/IndexRequest.php index 02693fc..a458b65 100644 --- a/src/Http/Requests/Note/IndexRequest.php +++ b/src/Http/Requests/Note/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -57,6 +62,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -64,6 +72,9 @@ class IndexRequest extends AbstractIndexRequest 'note_type' => ['column' => 'note_type', 'label' => 'Note Type', 'type' => 'string', 'nullable' => true], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Note/LockRequest.php b/src/Http/Requests/Note/LockRequest.php index e3b909f..d3596c5 100644 --- a/src/Http/Requests/Note/LockRequest.php +++ b/src/Http/Requests/Note/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Note/RestoreRequest.php b/src/Http/Requests/Note/RestoreRequest.php index 7b38a35..5429caa 100644 --- a/src/Http/Requests/Note/RestoreRequest.php +++ b/src/Http/Requests/Note/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Note/ShowRequest.php b/src/Http/Requests/Note/ShowRequest.php index 6535b6c..b0e7290 100644 --- a/src/Http/Requests/Note/ShowRequest.php +++ b/src/Http/Requests/Note/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -112,7 +111,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Note/UnlockRequest.php b/src/Http/Requests/Note/UnlockRequest.php index 25c636d..2e14562 100644 --- a/src/Http/Requests/Note/UnlockRequest.php +++ b/src/Http/Requests/Note/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Note/UpdateRequest.php b/src/Http/Requests/Note/UpdateRequest.php index 507d411..a4b9494 100644 --- a/src/Http/Requests/Note/UpdateRequest.php +++ b/src/Http/Requests/Note/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -112,7 +111,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/PaginationColumnsTrait.php b/src/Http/Requests/PaginationColumnsTrait.php deleted file mode 100644 index 1a1ae4e..0000000 --- a/src/Http/Requests/PaginationColumnsTrait.php +++ /dev/null @@ -1,78 +0,0 @@ - ['label' => 'Label', 'type' => 'string'], - // 'slug' => ['label' => 'Slug', 'type' => 'string'], - // 'byline' => ['label' => 'Byline', 'type' => 'string'], - // 'content' => ['label' => 'Content', 'type' => 'string'], - // 'description' => ['label' => 'Description', 'type' => 'string'], - // 'introduction' => ['label' => 'Introduction', 'type' => 'string'], - // 'summary' => ['label' => 'Summary', 'type' => 'string'], - // 'url' => ['label' => 'URL', 'type' => 'string'], - // 'rank' => ['label' => 'Rank', 'type' => 'integer'], - ]; - - public function getPaginationColumns(): array - { - return $this->paginationColumns; - } - - public function rules_filters_columns(array &$rules): void - { - foreach ($this->getPaginationColumns() as $column => $meta) { - if (empty($column) || !is_string($column)) { - continue; - } - - $rule_key = sprintf('filter.%1$s', $column); - - $nullable = array_key_exists('nullable', $meta) && is_bool($meta['nullable']) ? $meta['nullable'] : true; - - $set_rules = []; - - if ($nullable) { - $set_rules[] = 'nullable'; - } else { - // sometimes does not work here - $set_rules[] = 'nullable'; - } - - if (!empty($meta['type']) - && is_string($meta['type']) - ) { - // Dates - if (in_array($meta['type'], [ - 'date', - 'datetime', - ])) { - $set_rules[] = 'datetime'; - } elseif (in_array($meta['type'], [ - 'float', - 'decimal', - ])) { - $set_rules[] = 'float'; - } elseif (in_array($meta['type'], [ - 'integer', - ])) { - $set_rules[] = 'integer'; - } elseif (in_array($meta['type'], [ - 'string', - ])) { - $set_rules[] = 'string'; - } - } - - $rules[$rule_key] = $set_rules; - } - } -} diff --git a/src/Http/Requests/PaginationDatesTrait.php b/src/Http/Requests/PaginationDatesTrait.php deleted file mode 100644 index 09b30f3..0000000 --- a/src/Http/Requests/PaginationDatesTrait.php +++ /dev/null @@ -1,159 +0,0 @@ - ['label' => 'Created'], - 'updated_at' => ['label' => 'Updated'], - // 'deleted_at' => ['label' => 'Deleted'], - // 'start_at' => ['label' => 'Start'], - // 'end_at' => ['label' => 'End'], - ]; - - abstract public function getPaginationOperators(): array; - - abstract public function get(string $key, mixed $default = null); - - abstract public function merge(array $input); - - public function getPaginationDates(): array - { - return $this->paginationDates; - } - - public function rules_filters_dates(array &$rules): void - { - foreach ($this->getPaginationDates() as $column => $meta) { - if (empty($column) || !is_string($column)) { - continue; - } - - $rule_key = sprintf('filter.%1$s', $column); - - $rules[$rule_key] = 'nullable'; - } - } - - public function prepareForValidationForDates(): ?array - { - // $params = [ - // 'filter' => [ - // 'updated_at' => [ - // 'operator' => '>=', - // 'value' => '-3 days midnight' - // ], - // 'created_at' => '2023-03%', - // ], - // ]; - $dates = $this->getPaginationDates(); - - $filter = $this->get('filter'); - if (empty($filter) || !is_array($filter)) { - return null; - } - // dump([ - // '__METHOD__' => __METHOD__, - // '__LINE__' => __LINE__, - // '$filter' => $filter, - // 'http_build_query' => http_build_query($params), - // ]); - - $merge = false; - foreach ($dates as $column => $meta) { - $filter_expects_array = false; - $unset = true; - $options = [ - 'operator' => '=', - 'parse' => true, - 'value' => null, - ]; - if (array_key_exists($column, $filter)) { - if (is_array($filter[$column])) { - $merge = true; - $unset = false; - - if (array_key_exists('parse', $filter[$column])) { - $options['parse'] = !empty($filter[$column]['parse']); - } - - $filter_operators = $this->getPaginationOperators(); - - if (array_key_exists('operator', $filter[$column]) - && is_string($filter[$column]['operator']) - && array_key_exists(strtoupper($filter[$column]['operator']), $filter_operators) - ) { - $options['operator'] = strtoupper($filter[$column]['operator']); - } - - if (in_array($options['operator'], [ - 'BETWEEN', - 'NOTBETWEEN', - ])) { - $filter_expects_array = true; - } - - if (array_key_exists('value', $filter[$column])) { - if ($filter_expects_array && !is_array($filter[$column]['value'])) { - $unset = true; - } elseif (is_string($filter[$column]['value'])) { - if ($options['parse']) { - $options['value'] = Carbon::parse($filter[$column]['value'])->format('Y-m-d H:i:s'); - } else { - $options['value'] = $filter[$column]['value']; - } - } - } - if (!$unset) { - $filter[$column] = $options; - } - // dump([ - // '__METHOD__' => __METHOD__, - // '__LINE__' => __LINE__, - // '$column' => $column, - // '$filter[$column]' => $filter[$column], - // ]); - } elseif (is_string($filter[$column])) { - // dump([ - // '__METHOD__' => __METHOD__, - // '__LINE__' => __LINE__, - // '$column' => $column, - // '$filter[$column]' => $filter[$column], - // ]); - $merge = true; - $unset = false; - } else { - $unset = true; - } - - if ($unset) { - $merge = true; - unset($filter[$column]); - } - } - } - // dump([ - // '__METHOD__' => __METHOD__, - // '__LINE__' => __LINE__, - // '$filter' => $filter, - // '$merge' => $merge, - // ]); - - if ($merge) { - $this->merge([ - 'filter' => $filter, - ]); - } - - return $filter; - } -} diff --git a/src/Http/Requests/PaginationFlagsTrait.php b/src/Http/Requests/PaginationFlagsTrait.php deleted file mode 100644 index 119089b..0000000 --- a/src/Http/Requests/PaginationFlagsTrait.php +++ /dev/null @@ -1,46 +0,0 @@ - ['label' => 'Active'], - 'flagged' => ['label' => 'Flagged'], - 'locked' => ['label' => 'Locked'], - ]; - - public function getPaginationFlags(): array - { - return $this->paginationFlags; - } - - public function rules_filters_flags(array &$rules): void - { - foreach ($this->getPaginationFlags() as $column => $meta) { - if (empty($column) || !is_string($column)) { - continue; - } - - $rule_key = sprintf('filter.%1$s', $column); - - $nullable = array_key_exists('nullable', $meta) && is_bool($meta['nullable']) ? $meta['nullable'] : true; - - $set_rules = []; - - if ($nullable) { - $set_rules[] = 'nullable'; - } - - $set_rules[] = 'boolean'; - - $rules[$rule_key] = $set_rules; - } - } -} diff --git a/src/Http/Requests/PaginationIdsTrait.php b/src/Http/Requests/PaginationIdsTrait.php deleted file mode 100644 index 25b88df..0000000 --- a/src/Http/Requests/PaginationIdsTrait.php +++ /dev/null @@ -1,78 +0,0 @@ - ['label' => 'ID', 'type' => 'uuid'], - // 'created_by_id' => ['label' => 'Created By', 'type' => 'uuid'], - // 'modified_by_id' => ['label' => 'Modified By', 'type' => 'uuid'], - // 'owned_by_id' => ['label' => 'Owner', 'type' => 'uuid'], - // 'parent_id' => ['label' => 'Parent', 'type' => 'uuid'], - ]; - - public function getPaginationIds(): array - { - return $this->paginationIds; - } - - public function rules_filters_ids(array &$rules): void - { - foreach ($this->getPaginationIds() as $column => $meta) { - if (empty($column) || !is_string($column)) { - continue; - } - - $rule_key = sprintf('filter.%1$s', $column); - - $rules[$rule_key] = 'nullable'; - } - } - - public function prepareForValidationIds(): ?array - { - $filter = $this->input('filter'); - - $merge = false; - - foreach ($this->getPaginationIds() as $column => $meta) { - if (!empty($filter[$column])) { - $id = []; - if (is_array($filter[$column])) { - foreach ($filter[$column] as $key => $value) { - if (!empty($meta['type']) && 'integer' === $meta['type']) { - if (is_numeric($value) && $value > 0) { - $id[] = intval($value); - } - } else { - if (is_string($value) && $value) { - $id[] = $value; - } - } - } - } elseif (is_numeric($filter[$column]) && $filter[$column] > 0) { - $id[] = intval($filter[$column]); - } elseif (is_string($filter[$column]) && $filter[$column]) { - $id[] = $filter[$column]; - } - $filter[$column] = $id; - $merge = true; - } - } - - if ($merge) { - $this->merge([ - 'filter' => $filter, - ]); - } - - return $filter; - } -} diff --git a/src/Http/Requests/PaginationSortableTrait.php b/src/Http/Requests/PaginationSortableTrait.php deleted file mode 100644 index a88ad79..0000000 --- a/src/Http/Requests/PaginationSortableTrait.php +++ /dev/null @@ -1,62 +0,0 @@ - ['label' => 'Label', 'type' => 'string'], - // 'rank' => ['label' => 'Rank', 'type' => 'numeric'], - // 'slug' => ['label' => 'Slug', 'type' => 'string'], - // 'active' => ['label' => 'Active', 'type' => 'boolean'], - // 'flagged' => ['label' => 'Flagged', 'type' => 'boolean'], - // 'locked' => ['label' => 'Locked', 'type' => 'boolean'], - ]; - - public function getSortable(): array - { - return $this->sortable; - } - - public function rules_sortable(array &$rules): void - { - $sortable = $this->getSortable(); - - if (!empty($sortable)) { - $rules['sort.*'] = [ - 'string' - ]; - $rules['sort.*'][] = sprintf('in:%1$s', sprintf( - '%1$s,-%2$s', - implode(',', array_keys($sortable)), - implode(',-', array_keys($sortable)) - )); - } - } - - public function prepareForValidationSort(): void - { - $sortable = []; - - $sort = $this->input('sort'); - - if (!empty($sort)) { - if (is_string($sort)) { - // Convert sort to array - $sortable = explode(',', $sort); - } elseif (is_array($sort)) { - $sortable = $sort; - } - } - - $this->merge([ - 'sort' => $sortable, - ]); - } -} diff --git a/src/Http/Requests/Project/CreateRequest.php b/src/Http/Requests/Project/CreateRequest.php index 5e24de3..84f7e3b 100644 --- a/src/Http/Requests/Project/CreateRequest.php +++ b/src/Http/Requests/Project/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Project/DestroyRequest.php b/src/Http/Requests/Project/DestroyRequest.php index 726755b..46f4a3d 100644 --- a/src/Http/Requests/Project/DestroyRequest.php +++ b/src/Http/Requests/Project/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Project/EditRequest.php b/src/Http/Requests/Project/EditRequest.php index 4d418db..8944df8 100644 --- a/src/Http/Requests/Project/EditRequest.php +++ b/src/Http/Requests/Project/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Project/IndexRequest.php b/src/Http/Requests/Project/IndexRequest.php index 42e6cd4..17e143d 100644 --- a/src/Http/Requests/Project/IndexRequest.php +++ b/src/Http/Requests/Project/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -57,6 +62,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -78,6 +86,9 @@ class IndexRequest extends AbstractIndexRequest 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Project/LockRequest.php b/src/Http/Requests/Project/LockRequest.php index 7240425..6d6aea5 100644 --- a/src/Http/Requests/Project/LockRequest.php +++ b/src/Http/Requests/Project/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Project/RestoreRequest.php b/src/Http/Requests/Project/RestoreRequest.php index becf81d..3fa23b4 100644 --- a/src/Http/Requests/Project/RestoreRequest.php +++ b/src/Http/Requests/Project/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Project/ShowRequest.php b/src/Http/Requests/Project/ShowRequest.php index a4b6528..9c91e1f 100644 --- a/src/Http/Requests/Project/ShowRequest.php +++ b/src/Http/Requests/Project/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Project/UnlockRequest.php b/src/Http/Requests/Project/UnlockRequest.php index 84fed03..8bbd330 100644 --- a/src/Http/Requests/Project/UnlockRequest.php +++ b/src/Http/Requests/Project/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Project/UpdateRequest.php b/src/Http/Requests/Project/UpdateRequest.php index 0d7db6a..3946ef6 100644 --- a/src/Http/Requests/Project/UpdateRequest.php +++ b/src/Http/Requests/Project/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Release/CreateRequest.php b/src/Http/Requests/Release/CreateRequest.php index feba3ac..9383298 100644 --- a/src/Http/Requests/Release/CreateRequest.php +++ b/src/Http/Requests/Release/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Release/DestroyRequest.php b/src/Http/Requests/Release/DestroyRequest.php index 731c4f2..bb9b91d 100644 --- a/src/Http/Requests/Release/DestroyRequest.php +++ b/src/Http/Requests/Release/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Release/EditRequest.php b/src/Http/Requests/Release/EditRequest.php index 4e13c6a..26de260 100644 --- a/src/Http/Requests/Release/EditRequest.php +++ b/src/Http/Requests/Release/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Release/IndexRequest.php b/src/Http/Requests/Release/IndexRequest.php index d79bedf..7642db8 100644 --- a/src/Http/Requests/Release/IndexRequest.php +++ b/src/Http/Requests/Release/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -57,6 +62,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -78,6 +86,9 @@ class IndexRequest extends AbstractIndexRequest 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Release/LockRequest.php b/src/Http/Requests/Release/LockRequest.php index 6656e92..b4ff9c4 100644 --- a/src/Http/Requests/Release/LockRequest.php +++ b/src/Http/Requests/Release/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Release/RestoreRequest.php b/src/Http/Requests/Release/RestoreRequest.php index 3805575..83bd01d 100644 --- a/src/Http/Requests/Release/RestoreRequest.php +++ b/src/Http/Requests/Release/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Release/ShowRequest.php b/src/Http/Requests/Release/ShowRequest.php index d6af723..ed9e4b2 100644 --- a/src/Http/Requests/Release/ShowRequest.php +++ b/src/Http/Requests/Release/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Release/UnlockRequest.php b/src/Http/Requests/Release/UnlockRequest.php index c7f8594..478113a 100644 --- a/src/Http/Requests/Release/UnlockRequest.php +++ b/src/Http/Requests/Release/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Release/UpdateRequest.php b/src/Http/Requests/Release/UpdateRequest.php index 33bbef8..8d08382 100644 --- a/src/Http/Requests/Release/UpdateRequest.php +++ b/src/Http/Requests/Release/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Roadmap/CreateRequest.php b/src/Http/Requests/Roadmap/CreateRequest.php index 0d12f4c..0480ca1 100644 --- a/src/Http/Requests/Roadmap/CreateRequest.php +++ b/src/Http/Requests/Roadmap/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Roadmap/DestroyRequest.php b/src/Http/Requests/Roadmap/DestroyRequest.php index 5509bb1..27a07d3 100644 --- a/src/Http/Requests/Roadmap/DestroyRequest.php +++ b/src/Http/Requests/Roadmap/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Roadmap/EditRequest.php b/src/Http/Requests/Roadmap/EditRequest.php index 73f0f2b..04667a7 100644 --- a/src/Http/Requests/Roadmap/EditRequest.php +++ b/src/Http/Requests/Roadmap/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Roadmap/IndexRequest.php b/src/Http/Requests/Roadmap/IndexRequest.php index 320fe7d..33210da 100644 --- a/src/Http/Requests/Roadmap/IndexRequest.php +++ b/src/Http/Requests/Roadmap/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -57,6 +62,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -78,6 +86,9 @@ class IndexRequest extends AbstractIndexRequest 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Roadmap/LockRequest.php b/src/Http/Requests/Roadmap/LockRequest.php index c4d04f3..9027396 100644 --- a/src/Http/Requests/Roadmap/LockRequest.php +++ b/src/Http/Requests/Roadmap/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Roadmap/RestoreRequest.php b/src/Http/Requests/Roadmap/RestoreRequest.php index 53eda0f..454e5d3 100644 --- a/src/Http/Requests/Roadmap/RestoreRequest.php +++ b/src/Http/Requests/Roadmap/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Roadmap/ShowRequest.php b/src/Http/Requests/Roadmap/ShowRequest.php index da5fdbb..67a0cdb 100644 --- a/src/Http/Requests/Roadmap/ShowRequest.php +++ b/src/Http/Requests/Roadmap/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Roadmap/UnlockRequest.php b/src/Http/Requests/Roadmap/UnlockRequest.php index 72e0928..ac9d776 100644 --- a/src/Http/Requests/Roadmap/UnlockRequest.php +++ b/src/Http/Requests/Roadmap/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Roadmap/UpdateRequest.php b/src/Http/Requests/Roadmap/UpdateRequest.php index 50ec5c1..f461235 100644 --- a/src/Http/Requests/Roadmap/UpdateRequest.php +++ b/src/Http/Requests/Roadmap/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Source/CreateRequest.php b/src/Http/Requests/Source/CreateRequest.php index 337a70b..7f1e9c9 100644 --- a/src/Http/Requests/Source/CreateRequest.php +++ b/src/Http/Requests/Source/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Source/DestroyRequest.php b/src/Http/Requests/Source/DestroyRequest.php index e3c0b73..23a82c1 100644 --- a/src/Http/Requests/Source/DestroyRequest.php +++ b/src/Http/Requests/Source/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Source/EditRequest.php b/src/Http/Requests/Source/EditRequest.php index 25298d6..411149c 100644 --- a/src/Http/Requests/Source/EditRequest.php +++ b/src/Http/Requests/Source/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Source/IndexRequest.php b/src/Http/Requests/Source/IndexRequest.php index 98e5b31..abeca04 100644 --- a/src/Http/Requests/Source/IndexRequest.php +++ b/src/Http/Requests/Source/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -57,6 +62,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -78,6 +86,9 @@ class IndexRequest extends AbstractIndexRequest 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Source/LockRequest.php b/src/Http/Requests/Source/LockRequest.php index 2bec842..14a7011 100644 --- a/src/Http/Requests/Source/LockRequest.php +++ b/src/Http/Requests/Source/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Source/RestoreRequest.php b/src/Http/Requests/Source/RestoreRequest.php index c096042..fa9afea 100644 --- a/src/Http/Requests/Source/RestoreRequest.php +++ b/src/Http/Requests/Source/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Source/ShowRequest.php b/src/Http/Requests/Source/ShowRequest.php index 8f367e5..c002bd0 100644 --- a/src/Http/Requests/Source/ShowRequest.php +++ b/src/Http/Requests/Source/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Source/UnlockRequest.php b/src/Http/Requests/Source/UnlockRequest.php index 0c93761..6b57897 100644 --- a/src/Http/Requests/Source/UnlockRequest.php +++ b/src/Http/Requests/Source/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Source/UpdateRequest.php b/src/Http/Requests/Source/UpdateRequest.php index 3d0a639..150d126 100644 --- a/src/Http/Requests/Source/UpdateRequest.php +++ b/src/Http/Requests/Source/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Sprint/CreateRequest.php b/src/Http/Requests/Sprint/CreateRequest.php index f2715bd..7ecf321 100644 --- a/src/Http/Requests/Sprint/CreateRequest.php +++ b/src/Http/Requests/Sprint/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Sprint/DestroyRequest.php b/src/Http/Requests/Sprint/DestroyRequest.php index ce36031..732f5f1 100644 --- a/src/Http/Requests/Sprint/DestroyRequest.php +++ b/src/Http/Requests/Sprint/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Sprint/EditRequest.php b/src/Http/Requests/Sprint/EditRequest.php index f21f37b..e7e6e13 100644 --- a/src/Http/Requests/Sprint/EditRequest.php +++ b/src/Http/Requests/Sprint/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Sprint/IndexRequest.php b/src/Http/Requests/Sprint/IndexRequest.php index 7671300..8e3c413 100644 --- a/src/Http/Requests/Sprint/IndexRequest.php +++ b/src/Http/Requests/Sprint/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -57,6 +62,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -78,6 +86,9 @@ class IndexRequest extends AbstractIndexRequest 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Sprint/LockRequest.php b/src/Http/Requests/Sprint/LockRequest.php index 0e666ba..19d1c37 100644 --- a/src/Http/Requests/Sprint/LockRequest.php +++ b/src/Http/Requests/Sprint/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Sprint/RestoreRequest.php b/src/Http/Requests/Sprint/RestoreRequest.php index e9fa041..c0a2725 100644 --- a/src/Http/Requests/Sprint/RestoreRequest.php +++ b/src/Http/Requests/Sprint/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Sprint/ShowRequest.php b/src/Http/Requests/Sprint/ShowRequest.php index b0b1d29..ba782c8 100644 --- a/src/Http/Requests/Sprint/ShowRequest.php +++ b/src/Http/Requests/Sprint/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Sprint/UnlockRequest.php b/src/Http/Requests/Sprint/UnlockRequest.php index ba5aeb7..0fe00b4 100644 --- a/src/Http/Requests/Sprint/UnlockRequest.php +++ b/src/Http/Requests/Sprint/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Sprint/UpdateRequest.php b/src/Http/Requests/Sprint/UpdateRequest.php index 4e101bc..99a60c1 100644 --- a/src/Http/Requests/Sprint/UpdateRequest.php +++ b/src/Http/Requests/Sprint/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/StoreContentTrait.php b/src/Http/Requests/StoreContentTrait.php deleted file mode 100644 index 05cae92..0000000 --- a/src/Http/Requests/StoreContentTrait.php +++ /dev/null @@ -1,79 +0,0 @@ -getHtmlPurifier()->purify($content); - } - - /** - * Get HTMLPurifier - * - * @return \HTMLPurifier - */ - public function getHtmlPurifier(array $config = []): HTMLPurifier - { - if (null === $this->purifier) { - $hpc = \HTMLPurifier_Config::createDefault(); - - $config = empty($config) ? config('playground-matrix-resource') : $config; - - $safeIframeRegexp = !empty($config['content']) - && array_has_key(iframes, $config['content']) - && is_string($config['content']['iframes']) - ? $config['content']['iframes'] - : '%^(https?:)?(\/\/www\.youtube(?:-nocookie)?\.com\/embed\/|\/\/player\.vimeo\.com\/)%' - ; - - $serializerPath = !empty($config['cache']) - && !empty($config['cache']['purifier']) - && is_string($config['cache']['purifier']) - ? $config['cache']['purifier'] - : null - ; - - if ($serializerPath) { - $hpc->set('Cache.SerializerPath', $serializerPath); - } - - if ($safeIframeRegexp) { - $hpc->set('HTML.SafeIframe', true); - $hpc->set('URI.SafeIframeRegexp', $safeIframeRegexp); - } - - $this->purifier = new HTMLPurifier($hpc); - } - - return $this->purifier; - } -} diff --git a/src/Http/Requests/StoreFilterTrait.php b/src/Http/Requests/StoreFilterTrait.php deleted file mode 100644 index 769440d..0000000 --- a/src/Http/Requests/StoreFilterTrait.php +++ /dev/null @@ -1,317 +0,0 @@ - 0; - } else { - return (bool) $value; - } - } - - /** - * Filter a date value as a MySQL UTC string. - */ - public function filterDate(mixed $value): ?string - { - return is_string($value) - && !empty($value) - ? gmdate($this->date_format, strtotime($value)) : null - ; - } - - /** - * Filter a date value as a Carbon date. - */ - public function filterDateAsCarbon($value): ?Carbon - { - return empty($value) ? null : Carbon::parse($value); - } - - /** - * Filter an email address. - */ - public function filterEmail($email): string - { - return is_string($email) ? filter_var($email, FILTER_SANITIZE_EMAIL) : ''; - } - - /** - * Filter a float value - * - * NOTE: Implement handling for locales. - * - * @param string $value The value to filter. - * @param string $locale i18n - * - */ - public function filterFloat( - mixed $value, - string $locale = 'en-US' - ): ?float { - if ('' === $value || null === $value) { - return null; - } - - return (new \NumberFormatter($locale, \NumberFormatter::DECIMAL))->parse($value); - } - - /** - * Filter HTML from content. - * - * FILTER_FLAG_NO_ENCODE_QUOTES - do not encode quotes. - * - */ - public function filterHtml(mixed $content): string - { - return is_string($content) - ? filter_var($content, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES) - : '' - ; - } - - /** - * Filter an integer value - * - */ - public function filterInteger( - mixed $value, - string $locale = 'en-US' - ): int { - if ('' === $value || null === $value) { - return 0; - } - - $value = (new \NumberFormatter($locale, \NumberFormatter::DECIMAL))->parse($value, \NumberFormatter::TYPE_INT64); - - return is_numeric($value) ? $value : 0; - } - - /** - * Filter an integer value ID. - */ - public function filterIntegerId(mixed $value): ?int - { - return is_numeric($value) && ($value > 0) ? (int) $value : null; - } - - /** - * Filter a positive integer value or return null. - */ - public function filterIntegerPositive(mixed $value): ?int - { - return is_numeric($value) && ($value > 0) ? (int) $value : null; - } - - /** - * Filter a percent value - * - * NOTE: Only removes the percent sign. - * - * @param string $value The value to filter. - * @param string $locale i18n - * - * @return float - */ - public function filterPercent(mixed $value, $locale = 'en-US') - { - if ('' === $value || null === $value || is_numeric($value)) { - return null; - } - - return $this->filterFloat(str_replace('%', '', $value), $locale); - } - - /** - * Filter a phone number. - */ - public function filterPhone($value, string $locale = 'en-US'): string - { - if (empty($value)) { - return ''; - } - - if (is_numeric($value)) { - return strval($value); - } - - return is_string($value) - ? filter_var(str_replace(['-', '.', '+'], '', $value), FILTER_SANITIZE_NUMBER_INT) - : '' - ; - } - - // /** - // * Filter the status - // * - // * TODO Determine if $input should be passed by reference: &$input - // * - // * @param array $input The status input. - // * - // * @return integer|NULL - // */ - // public function filterStatus(array $input = []) - // { - // if (!isset($input['status'])) { - // return $input; - // } - - // if (is_numeric($input['status'])) { - // $input['status'] = (int) abs($input['status']); - // return $input; - // } - - // if (is_array($input['status'])) { - // foreach ($input['status'] as $key => $value) { - // $input['status'][$key] = (bool) $value; - // } - // } - - // return $input; - // } - - // /** - // * Filter common fields - // * - // * @param array $input The common fields: locale, icon, avatar, image - // * - // * @return integer|NULL - // */ - // public function filterCommonFields(array $input = []) - // { - // $input['locale'] = isset($input['locale']) ? $this->filterHtml($input['locale']) : ''; - // $input['icon'] = isset($input['icon']) ? $this->filterHtml($input['icon']) : ''; - // $input['avatar'] = isset($input['avatar']) ? $this->filterHtml($input['avatar']) : ''; - // $input['image'] = isset($input['image']) ? $this->filterHtml($input['image']) : ''; - - // return $input; - // } - - // /** - // * Filter system fields - // * - // * @param array $input The system fields input. - // * - // * @return integer|NULL - // */ - // public function filterSystemFields(array $input = []) - // { - // // Filter system fields. - // if (isset($input['gids'])) { - // $input['gids'] = (int) abs($input['gids']); - // } - - // /** - // * @var integer $pBits The allowed permission bits: rwx - // */ - // $pBits = 4 + 2 + 1; - - // if (isset($input['po'])) { - // $input['po'] = intval(abs($input['po'])) & $pBits; - // } - - // if (isset($input['pg'])) { - // $input['pg'] = intval(abs($input['pg'])) & $pBits; - // } - - // if (isset($input['pw'])) { - // $input['pw'] = intval(abs($input['pw'])) & $pBits; - // } - - // if (isset($input['rank'])) { - // $input['rank'] = (int) $input['rank']; - // } - - // if (isset($input['size'])) { - // $input['size'] = (int) $input['size']; - // } - - // return $input; - // return $this->filterStatus($input); - // } - - /** - * Filter a UUID. - */ - public function filterUuid($uuid): ?string - { - return Uuid::isValid($uuid) ? $value : null; - } -} diff --git a/src/Http/Requests/StoreSlugTrait.php b/src/Http/Requests/StoreSlugTrait.php deleted file mode 100644 index f0b5ffa..0000000 --- a/src/Http/Requests/StoreSlugTrait.php +++ /dev/null @@ -1,84 +0,0 @@ -slug_table) { - $rules['slug'][] = sprintf('unique:%1$s', $this->slug_table); - } - } - - public function rules_store_slug_update(array &$rules): void - { - $rules['slug'] = [ - 'nullable', - 'string', - ]; - - if ($this->slug_table) { - $rules['slug'][] = sprintf('unique:%1$s,id,%2$s', $this->slug_table, $this->id); - } - } - - public function prepareForValidationForSlug(): array - { - $slug = $this->get('slug'); - $title = $this->get('title'); - $label = $this->get('label'); - - $merge = false; - - if (empty($slug) && (!empty($label) || !empty($title))) { - if (!empty($title)) { - $merge = true; - $slug = Str::of($title)->slug('-')->toString(); - } elseif (!empty($label)) { - $merge = true; - $slug = Str::of($label)->slug('-')->toString(); - } - } elseif (!empty($slug)) { - $merge = true; - $slug = Str::of($slug)->slug('-')->toString(); - } - - // dd([ - // '__METHOD__' => __METHOD__, - // '__FILE__' => __FILE__, - // '__LINE__' => __LINE__, - // '$merge' => $merge, - // '$slug' => $slug, - // '$title' => $title, - // '$label' => $label, - // ]); - - if ($merge) { - $this->merge([ - 'slug' => $slug, - ]); - } - - return [ - 'slug' => $slug, - 'label' => $label, - 'title' => $title, - ]; - } -} diff --git a/src/Http/Requests/Tag/CreateRequest.php b/src/Http/Requests/Tag/CreateRequest.php index d7d4cbe..2d4f963 100644 --- a/src/Http/Requests/Tag/CreateRequest.php +++ b/src/Http/Requests/Tag/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Tag/DestroyRequest.php b/src/Http/Requests/Tag/DestroyRequest.php index 8ae0fa6..f9689e6 100644 --- a/src/Http/Requests/Tag/DestroyRequest.php +++ b/src/Http/Requests/Tag/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Tag/EditRequest.php b/src/Http/Requests/Tag/EditRequest.php index 233636d..c80dc67 100644 --- a/src/Http/Requests/Tag/EditRequest.php +++ b/src/Http/Requests/Tag/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Tag/IndexRequest.php b/src/Http/Requests/Tag/IndexRequest.php index e7a392f..419eae6 100644 --- a/src/Http/Requests/Tag/IndexRequest.php +++ b/src/Http/Requests/Tag/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -57,6 +62,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -78,6 +86,9 @@ class IndexRequest extends AbstractIndexRequest 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Tag/LockRequest.php b/src/Http/Requests/Tag/LockRequest.php index 2bceef9..4846943 100644 --- a/src/Http/Requests/Tag/LockRequest.php +++ b/src/Http/Requests/Tag/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Tag/RestoreRequest.php b/src/Http/Requests/Tag/RestoreRequest.php index fd6fa15..7e97ad4 100644 --- a/src/Http/Requests/Tag/RestoreRequest.php +++ b/src/Http/Requests/Tag/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Tag/ShowRequest.php b/src/Http/Requests/Tag/ShowRequest.php index 71cd4ec..adeeb6c 100644 --- a/src/Http/Requests/Tag/ShowRequest.php +++ b/src/Http/Requests/Tag/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Tag/UnlockRequest.php b/src/Http/Requests/Tag/UnlockRequest.php index 1875846..a9622df 100644 --- a/src/Http/Requests/Tag/UnlockRequest.php +++ b/src/Http/Requests/Tag/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Tag/UpdateRequest.php b/src/Http/Requests/Tag/UpdateRequest.php index f8ccc07..22a9b84 100644 --- a/src/Http/Requests/Tag/UpdateRequest.php +++ b/src/Http/Requests/Tag/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Team/CreateRequest.php b/src/Http/Requests/Team/CreateRequest.php index dc8df66..5290aa8 100644 --- a/src/Http/Requests/Team/CreateRequest.php +++ b/src/Http/Requests/Team/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Team/DestroyRequest.php b/src/Http/Requests/Team/DestroyRequest.php index 76bcc1a..ad83659 100644 --- a/src/Http/Requests/Team/DestroyRequest.php +++ b/src/Http/Requests/Team/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Team/EditRequest.php b/src/Http/Requests/Team/EditRequest.php index d477bc4..6fe3887 100644 --- a/src/Http/Requests/Team/EditRequest.php +++ b/src/Http/Requests/Team/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Team/IndexRequest.php b/src/Http/Requests/Team/IndexRequest.php index 536a961..b6deb21 100644 --- a/src/Http/Requests/Team/IndexRequest.php +++ b/src/Http/Requests/Team/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -57,6 +62,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -78,6 +86,9 @@ class IndexRequest extends AbstractIndexRequest 'version_id' => ['column' => 'version_id', 'label' => 'Version Id', 'type' => 'uuid', 'nullable' => false], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Team/LockRequest.php b/src/Http/Requests/Team/LockRequest.php index 18088cc..3b60331 100644 --- a/src/Http/Requests/Team/LockRequest.php +++ b/src/Http/Requests/Team/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Team/RestoreRequest.php b/src/Http/Requests/Team/RestoreRequest.php index e24d9bc..a9c0e36 100644 --- a/src/Http/Requests/Team/RestoreRequest.php +++ b/src/Http/Requests/Team/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Team/ShowRequest.php b/src/Http/Requests/Team/ShowRequest.php index 5eb3d0d..2749dee 100644 --- a/src/Http/Requests/Team/ShowRequest.php +++ b/src/Http/Requests/Team/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Team/UnlockRequest.php b/src/Http/Requests/Team/UnlockRequest.php index 2165c45..68ea4f5 100644 --- a/src/Http/Requests/Team/UnlockRequest.php +++ b/src/Http/Requests/Team/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Team/UpdateRequest.php b/src/Http/Requests/Team/UpdateRequest.php index ecf3363..e852a0d 100644 --- a/src/Http/Requests/Team/UpdateRequest.php +++ b/src/Http/Requests/Team/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Ticket/CreateRequest.php b/src/Http/Requests/Ticket/CreateRequest.php index 4393a35..b23aac2 100644 --- a/src/Http/Requests/Ticket/CreateRequest.php +++ b/src/Http/Requests/Ticket/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Ticket/DestroyRequest.php b/src/Http/Requests/Ticket/DestroyRequest.php index 58a0aac..5951c36 100644 --- a/src/Http/Requests/Ticket/DestroyRequest.php +++ b/src/Http/Requests/Ticket/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Ticket/EditRequest.php b/src/Http/Requests/Ticket/EditRequest.php index 53fbaf1..31dbc79 100644 --- a/src/Http/Requests/Ticket/EditRequest.php +++ b/src/Http/Requests/Ticket/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Ticket/IndexRequest.php b/src/Http/Requests/Ticket/IndexRequest.php index 1964068..d3e9baf 100644 --- a/src/Http/Requests/Ticket/IndexRequest.php +++ b/src/Http/Requests/Ticket/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => true], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => true], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -53,6 +58,9 @@ class IndexRequest extends AbstractIndexRequest 'unknown' => ['column' => 'unknown', 'label' => 'Unknown', 'icon' => 'fa-solid fa-question text-warning'], ]; + /** + * @var array + */ protected array $paginationIds = [ 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'uuid', 'nullable' => false], 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created By Id', 'type' => 'uuid', 'nullable' => true], @@ -80,6 +88,9 @@ class IndexRequest extends AbstractIndexRequest 'version_fixed_id' => ['column' => 'version_fixed_id', 'label' => 'Version Fixed Id', 'type' => 'uuid', 'nullable' => true], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'title' => ['column' => 'title', 'label' => 'Title', 'type' => 'string', 'nullable' => false], @@ -106,6 +117,9 @@ class IndexRequest extends AbstractIndexRequest 'reproducibility' => ['column' => 'reproducibility', 'label' => 'Reproducibility', 'type' => 'decimal', 'nullable' => true], ]; + /** + * @var array + */ protected array $sortable = [ 'id' => ['column' => 'id', 'label' => 'Id', 'type' => 'string'], 'created_by_id' => ['column' => 'created_by_id', 'label' => 'Created By Id', 'type' => 'string'], diff --git a/src/Http/Requests/Ticket/LockRequest.php b/src/Http/Requests/Ticket/LockRequest.php index 520ecda..68d234f 100644 --- a/src/Http/Requests/Ticket/LockRequest.php +++ b/src/Http/Requests/Ticket/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Ticket/RestoreRequest.php b/src/Http/Requests/Ticket/RestoreRequest.php index a3db1f2..b1a0981 100644 --- a/src/Http/Requests/Ticket/RestoreRequest.php +++ b/src/Http/Requests/Ticket/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Ticket/ShowRequest.php b/src/Http/Requests/Ticket/ShowRequest.php index de43659..5eca73a 100644 --- a/src/Http/Requests/Ticket/ShowRequest.php +++ b/src/Http/Requests/Ticket/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -152,7 +151,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Ticket/UnlockRequest.php b/src/Http/Requests/Ticket/UnlockRequest.php index 2be4eac..25c2b2f 100644 --- a/src/Http/Requests/Ticket/UnlockRequest.php +++ b/src/Http/Requests/Ticket/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Ticket/UpdateRequest.php b/src/Http/Requests/Ticket/UpdateRequest.php index ebee9c9..9d7f574 100644 --- a/src/Http/Requests/Ticket/UpdateRequest.php +++ b/src/Http/Requests/Ticket/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -152,7 +151,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Version/CreateRequest.php b/src/Http/Requests/Version/CreateRequest.php index 350898c..870e612 100644 --- a/src/Http/Requests/Version/CreateRequest.php +++ b/src/Http/Requests/Version/CreateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Version/DestroyRequest.php b/src/Http/Requests/Version/DestroyRequest.php index 817d231..2af0c1e 100644 --- a/src/Http/Requests/Version/DestroyRequest.php +++ b/src/Http/Requests/Version/DestroyRequest.php @@ -1,24 +1,28 @@ > */ 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(); diff --git a/src/Http/Requests/Version/EditRequest.php b/src/Http/Requests/Version/EditRequest.php index 243d316..650fc9c 100644 --- a/src/Http/Requests/Version/EditRequest.php +++ b/src/Http/Requests/Version/EditRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], diff --git a/src/Http/Requests/Version/IndexRequest.php b/src/Http/Requests/Version/IndexRequest.php index ec9946f..ec6166f 100644 --- a/src/Http/Requests/Version/IndexRequest.php +++ b/src/Http/Requests/Version/IndexRequest.php @@ -1,17 +1,19 @@ + */ protected array $paginationDates = [ 'created_at' => ['column' => 'created_at', 'label' => 'Created At', 'nullable' => false], 'updated_at' => ['column' => 'updated_at', 'label' => 'Updated At', 'nullable' => false], @@ -32,6 +34,9 @@ class IndexRequest extends AbstractIndexRequest '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'], @@ -57,6 +62,9 @@ class IndexRequest extends AbstractIndexRequest 'allow_public' => ['column' => 'allow_public', 'label' => 'Allow Public', 'icon' => 'fa-solid fa-users-line'], ]; + /** + * @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], @@ -78,6 +86,9 @@ class IndexRequest extends AbstractIndexRequest 'ticket_id' => ['column' => 'ticket_id', 'label' => 'Ticket Id', 'type' => 'uuid', 'nullable' => false], ]; + /** + * @var array + */ protected array $paginationColumns = [ 'label' => ['column' => 'label', 'label' => 'Label', 'type' => 'string', 'nullable' => false], 'byline' => ['column' => 'byline', 'label' => 'Byline', 'type' => 'string', 'nullable' => false], diff --git a/src/Http/Requests/Version/LockRequest.php b/src/Http/Requests/Version/LockRequest.php index e02c174..a9bf459 100644 --- a/src/Http/Requests/Version/LockRequest.php +++ b/src/Http/Requests/Version/LockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Version/RestoreRequest.php b/src/Http/Requests/Version/RestoreRequest.php index df447df..b2d4b03 100644 --- a/src/Http/Requests/Version/RestoreRequest.php +++ b/src/Http/Requests/Version/RestoreRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Version/ShowRequest.php b/src/Http/Requests/Version/ShowRequest.php index 371ac57..0d05257 100644 --- a/src/Http/Requests/Version/ShowRequest.php +++ b/src/Http/Requests/Version/ShowRequest.php @@ -1,14 +1,13 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Requests/Version/UnlockRequest.php b/src/Http/Requests/Version/UnlockRequest.php index c19070b..12c2716 100644 --- a/src/Http/Requests/Version/UnlockRequest.php +++ b/src/Http/Requests/Version/UnlockRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ '_return_url' => ['nullable', 'url'], diff --git a/src/Http/Requests/Version/UpdateRequest.php b/src/Http/Requests/Version/UpdateRequest.php index f48affd..5138273 100644 --- a/src/Http/Requests/Version/UpdateRequest.php +++ b/src/Http/Requests/Version/UpdateRequest.php @@ -1,19 +1,18 @@ > */ public const RULES = [ 'owned_by_id' => ['nullable', 'uuid'], @@ -126,7 +125,7 @@ protected function prepareForValidation() $input['introduction'] = ''; } - if (!empty($input)) { + if (! empty($input)) { $this->merge($input); } } diff --git a/src/Http/Resources/Backlog.php b/src/Http/Resources/Backlog.php index 9c99572..ee3eb84 100644 --- a/src/Http/Resources/Backlog.php +++ b/src/Http/Resources/Backlog.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?BacklogModel $backlog + */ + $backlog = $request->route('backlog'); + return [ 'meta' => [ - 'id' => $request?->backlog?->id, + 'id' => $backlog?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/BacklogCollection.php b/src/Http/Resources/BacklogCollection.php index b10a623..77d5433 100644 --- a/src/Http/Resources/BacklogCollection.php +++ b/src/Http/Resources/BacklogCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Board.php b/src/Http/Resources/Board.php index 7b16f98..3e194de 100644 --- a/src/Http/Resources/Board.php +++ b/src/Http/Resources/Board.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?BoardModel $board + */ + $board = $request->route('board'); + return [ 'meta' => [ - 'id' => $request?->board?->id, + 'id' => $board?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/BoardCollection.php b/src/Http/Resources/BoardCollection.php index e6ee489..131d4b4 100644 --- a/src/Http/Resources/BoardCollection.php +++ b/src/Http/Resources/BoardCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Epic.php b/src/Http/Resources/Epic.php index f5703ca..611e4df 100644 --- a/src/Http/Resources/Epic.php +++ b/src/Http/Resources/Epic.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?EpicModel $epic + */ + $epic = $request->route('epic'); + return [ 'meta' => [ - 'id' => $request?->epic?->id, + 'id' => $epic?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/EpicCollection.php b/src/Http/Resources/EpicCollection.php index c1297d0..090c544 100644 --- a/src/Http/Resources/EpicCollection.php +++ b/src/Http/Resources/EpicCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Flow.php b/src/Http/Resources/Flow.php index 3248ffd..c1490e1 100644 --- a/src/Http/Resources/Flow.php +++ b/src/Http/Resources/Flow.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?FlowModel $flow + */ + $flow = $request->route('flow'); + return [ 'meta' => [ - 'id' => $request?->flow?->id, + 'id' => $flow?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/FlowCollection.php b/src/Http/Resources/FlowCollection.php index e982da3..83981e3 100644 --- a/src/Http/Resources/FlowCollection.php +++ b/src/Http/Resources/FlowCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + '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 6e1baf9..64e8581 100644 --- a/src/Http/Resources/Milestone.php +++ b/src/Http/Resources/Milestone.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?MilestoneModel $milestone + */ + $milestone = $request->route('milestone'); + return [ 'meta' => [ - 'id' => $request?->milestone?->id, + 'id' => $milestone?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/MilestoneCollection.php b/src/Http/Resources/MilestoneCollection.php index ec3e06d..f31ac75 100644 --- a/src/Http/Resources/MilestoneCollection.php +++ b/src/Http/Resources/MilestoneCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Note.php b/src/Http/Resources/Note.php index ad924ed..7545633 100644 --- a/src/Http/Resources/Note.php +++ b/src/Http/Resources/Note.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?NoteModel $note + */ + $note = $request->route('note'); + return [ 'meta' => [ - 'id' => $request?->note?->id, + 'id' => $note?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/NoteCollection.php b/src/Http/Resources/NoteCollection.php index 75bd161..92cf0f9 100644 --- a/src/Http/Resources/NoteCollection.php +++ b/src/Http/Resources/NoteCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Project.php b/src/Http/Resources/Project.php index 2391b9e..36decfd 100644 --- a/src/Http/Resources/Project.php +++ b/src/Http/Resources/Project.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?ProjectModel $project + */ + $project = $request->route('project'); + return [ 'meta' => [ - 'id' => $request?->project?->id, + 'id' => $project?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/ProjectCollection.php b/src/Http/Resources/ProjectCollection.php index 88657b1..7ada3d1 100644 --- a/src/Http/Resources/ProjectCollection.php +++ b/src/Http/Resources/ProjectCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Release.php b/src/Http/Resources/Release.php index d177e4d..b116c6f 100644 --- a/src/Http/Resources/Release.php +++ b/src/Http/Resources/Release.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?ReleaseModel $release + */ + $release = $request->route('release'); + return [ 'meta' => [ - 'id' => $request?->release?->id, + 'id' => $release?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/ReleaseCollection.php b/src/Http/Resources/ReleaseCollection.php index 6e34738..a36eaf7 100644 --- a/src/Http/Resources/ReleaseCollection.php +++ b/src/Http/Resources/ReleaseCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Roadmap.php b/src/Http/Resources/Roadmap.php index 2703048..b623584 100644 --- a/src/Http/Resources/Roadmap.php +++ b/src/Http/Resources/Roadmap.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?RoadmapModel $roadmap + */ + $roadmap = $request->route('roadmap'); + return [ 'meta' => [ - 'id' => $request?->roadmap?->id, + 'id' => $roadmap?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/RoadmapCollection.php b/src/Http/Resources/RoadmapCollection.php index d9dd2af..3fab2a3 100644 --- a/src/Http/Resources/RoadmapCollection.php +++ b/src/Http/Resources/RoadmapCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Source.php b/src/Http/Resources/Source.php index 7e26ca9..4c0fdba 100644 --- a/src/Http/Resources/Source.php +++ b/src/Http/Resources/Source.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?SourceModel $source + */ + $source = $request->route('source'); + return [ 'meta' => [ - 'id' => $request?->source?->id, + 'id' => $source?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/SourceCollection.php b/src/Http/Resources/SourceCollection.php index 3c7ad66..ca4cea9 100644 --- a/src/Http/Resources/SourceCollection.php +++ b/src/Http/Resources/SourceCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Sprint.php b/src/Http/Resources/Sprint.php index ca3f99d..e9c71ad 100644 --- a/src/Http/Resources/Sprint.php +++ b/src/Http/Resources/Sprint.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?SprintModel $sprint + */ + $sprint = $request->route('sprint'); + return [ 'meta' => [ - 'id' => $request?->sprint?->id, + 'id' => $sprint?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/SprintCollection.php b/src/Http/Resources/SprintCollection.php index 28cbe48..3cec9d7 100644 --- a/src/Http/Resources/SprintCollection.php +++ b/src/Http/Resources/SprintCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Tag.php b/src/Http/Resources/Tag.php index 624e1aa..d487649 100644 --- a/src/Http/Resources/Tag.php +++ b/src/Http/Resources/Tag.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?TagModel $tag + */ + $tag = $request->route('tag'); + return [ 'meta' => [ - 'id' => $request?->tag?->id, + 'id' => $tag?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/TagCollection.php b/src/Http/Resources/TagCollection.php index d1b9978..11516fd 100644 --- a/src/Http/Resources/TagCollection.php +++ b/src/Http/Resources/TagCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Team.php b/src/Http/Resources/Team.php index 25fd6b0..2653a16 100644 --- a/src/Http/Resources/Team.php +++ b/src/Http/Resources/Team.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?TeamModel $team + */ + $team = $request->route('team'); + return [ 'meta' => [ - 'id' => $request?->team?->id, + 'id' => $team?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/TeamCollection.php b/src/Http/Resources/TeamCollection.php index 832c5b8..8e449ca 100644 --- a/src/Http/Resources/TeamCollection.php +++ b/src/Http/Resources/TeamCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Ticket.php b/src/Http/Resources/Ticket.php index 8a7ef1d..83a8980 100644 --- a/src/Http/Resources/Ticket.php +++ b/src/Http/Resources/Ticket.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?TicketModel $ticket + */ + $ticket = $request->route('ticket'); + return [ 'meta' => [ - 'id' => $request?->ticket?->id, + 'id' => $ticket?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/TicketCollection.php b/src/Http/Resources/TicketCollection.php index f4dc05e..0fa9841 100644 --- a/src/Http/Resources/TicketCollection.php +++ b/src/Http/Resources/TicketCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/Version.php b/src/Http/Resources/Version.php index 376ed3b..3e9c7b5 100644 --- a/src/Http/Resources/Version.php +++ b/src/Http/Resources/Version.php @@ -1,19 +1,20 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,15 +22,21 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&FormRequest $request * @return array */ public function with(Request $request): array { + /** + * @var ?VersionModel $version + */ + $version = $request->route('version'); + return [ 'meta' => [ - 'id' => $request?->version?->id, + 'id' => $version?->id, 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, + 'session_user_id' => $request->user()?->id, 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Http/Resources/VersionCollection.php b/src/Http/Resources/VersionCollection.php index 0284dec..6636f55 100644 --- a/src/Http/Resources/VersionCollection.php +++ b/src/Http/Resources/VersionCollection.php @@ -1,19 +1,19 @@ + * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable */ - public function toArray(Request $request): array + public function toArray(Request $request) { return parent::toArray($request); } @@ -21,6 +21,7 @@ public function toArray(Request $request): array /** * Get additional data that should be returned with the resource array. * + * @param Request&IndexRequest $request * @return array */ public function with(Request $request): array @@ -32,8 +33,8 @@ public function with(Request $request): array 'flags' => $request->getPaginationFlags(), 'ids' => $request->getPaginationIds(), 'rules' => $request->rules(), - 'session_user_id' => $request->user()->id, - 'sortable' => $request->getSortable(), + 'session_user_id' => $request->user()?->id, + 'sortable' => $request->getSortable(), 'timestamp' => Carbon::now()->toJson(), 'validated' => $request->validated(), ], diff --git a/src/Policies/BacklogPolicy.php b/src/Policies/BacklogPolicy.php index 2d76ce1..69444fd 100644 --- a/src/Policies/BacklogPolicy.php +++ b/src/Policies/BacklogPolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class BacklogPolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/BoardPolicy.php b/src/Policies/BoardPolicy.php index 2084324..4d0a40c 100644 --- a/src/Policies/BoardPolicy.php +++ b/src/Policies/BoardPolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class BoardPolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/EpicPolicy.php b/src/Policies/EpicPolicy.php index 78ef74e..226994d 100644 --- a/src/Policies/EpicPolicy.php +++ b/src/Policies/EpicPolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class EpicPolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/FlowPolicy.php b/src/Policies/FlowPolicy.php index e6fac4b..0af1741 100644 --- a/src/Policies/FlowPolicy.php +++ b/src/Policies/FlowPolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class FlowPolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/MilestonePolicy.php b/src/Policies/MilestonePolicy.php index 849c7b3..e3212d8 100644 --- a/src/Policies/MilestonePolicy.php +++ b/src/Policies/MilestonePolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class MilestonePolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/NotePolicy.php b/src/Policies/NotePolicy.php index aacaef9..1dd4abc 100644 --- a/src/Policies/NotePolicy.php +++ b/src/Policies/NotePolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class NotePolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/ProjectPolicy.php b/src/Policies/ProjectPolicy.php index c28f3f6..1beecdd 100644 --- a/src/Policies/ProjectPolicy.php +++ b/src/Policies/ProjectPolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class ProjectPolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/ReleasePolicy.php b/src/Policies/ReleasePolicy.php index de39fab..780ec1e 100644 --- a/src/Policies/ReleasePolicy.php +++ b/src/Policies/ReleasePolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class ReleasePolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/RoadmapPolicy.php b/src/Policies/RoadmapPolicy.php index 6373fae..a26e5d6 100644 --- a/src/Policies/RoadmapPolicy.php +++ b/src/Policies/RoadmapPolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class RoadmapPolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/SourcePolicy.php b/src/Policies/SourcePolicy.php index f5f911a..9a0f3c0 100644 --- a/src/Policies/SourcePolicy.php +++ b/src/Policies/SourcePolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class SourcePolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/SprintPolicy.php b/src/Policies/SprintPolicy.php index 0454e7a..596f7c5 100644 --- a/src/Policies/SprintPolicy.php +++ b/src/Policies/SprintPolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class SprintPolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/TagPolicy.php b/src/Policies/TagPolicy.php index 0071ffe..3f59c96 100644 --- a/src/Policies/TagPolicy.php +++ b/src/Policies/TagPolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class TagPolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/TeamPolicy.php b/src/Policies/TeamPolicy.php index 25f5723..0159116 100644 --- a/src/Policies/TeamPolicy.php +++ b/src/Policies/TeamPolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class TeamPolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/TicketPolicy.php b/src/Policies/TicketPolicy.php index 49a4cae..91ed9b5 100644 --- a/src/Policies/TicketPolicy.php +++ b/src/Policies/TicketPolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class TicketPolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/Policies/VersionPolicy.php b/src/Policies/VersionPolicy.php index 9944561..a697e9f 100644 --- a/src/Policies/VersionPolicy.php +++ b/src/Policies/VersionPolicy.php @@ -1,21 +1,20 @@ The roles allowed to view the MVC. */ protected $rolesToView = [ 'user', @@ -23,16 +22,16 @@ class VersionPolicy extends ModelPolicy 'publisher', 'manager', 'admin', - 'root' + 'root', ]; /** - * @var array $rolesForAction The roles allowed for actions in the MVC. + * @var array The roles allowed for actions in the MVC. */ protected $rolesForAction = [ 'publisher', 'manager', 'admin', - 'root' + 'root', ]; } diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 7b7b68d..c557f55 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -1,77 +1,59 @@ Policies\BacklogPolicy::class, - Models\Board::class => Policies\BoardPolicy::class, - Models\Epic::class => Policies\EpicPolicy::class, - Models\Flow::class => Policies\FlowPolicy::class, - Models\Milestone::class => Policies\MilestonePolicy::class, - Models\Note::class => Policies\NotePolicy::class, - Models\Project::class => Policies\ProjectPolicy::class, - Models\Release::class => Policies\ReleasePolicy::class, - Models\Roadmap::class => Policies\RoadmapPolicy::class, - Models\Source::class => Policies\SourcePolicy::class, - Models\Sprint::class => Policies\SprintPolicy::class, - Models\Tag::class => Policies\TagPolicy::class, - Models\Team::class => Policies\TeamPolicy::class, - Models\Ticket::class => Policies\TicketPolicy::class, - Models\Version::class => Policies\VersionPolicy::class, - ]; - /** * Bootstrap any package services. * Register any authentication / authorization services. - * - * @return void */ - public function boot() + public function boot(): void { + /** + * @var array $config + */ $config = config($this->package); - if (!empty($config)) { + if (! empty($config['load']) && is_array($config['load'])) { // $this->loadTranslationsFrom( // dirname(__DIR__).'/resources/lang', // 'playground-matrix-resource' // ); - if (!empty($config['load']['policies'])) { - $this->setPolicyNamespace($config); + if (! empty($config['load']['policies']) + && ! empty($config['policies']) + && is_array($config['policies']) + ) { + $this->setPolicies($config['policies']); $this->registerPolicies(); } - if (!empty($config['load']['routes'])) { - $this->routes($config); + if (! empty($config['load']['routes']) + && ! empty($config['routes']) + && is_array($config['routes']) + ) { + $this->routes($config['routes']); } - if (!empty($config['load']['views'])) { + if (! empty($config['load']['views'])) { $this->loadViewsFrom( - dirname(__DIR__) . '/resources/views', + dirname(__DIR__).'/resources/views', $this->package ); } @@ -79,116 +61,177 @@ public function boot() if ($this->app->runningInConsole()) { // Publish configuration $this->publishes([ - dirname(__DIR__).'/config/playground-matrix-resource.php' - => config_path($this->package.'.php') + 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') + dirname(__DIR__).'/routes' => base_path('routes/playground-matrix-resource'), ], 'playground-routes'); } } + if (! empty($config['layout']) && is_string($config['layout'])) { + View::share('layout', $config['layout']); + } + $this->about(); } /** * Register any application services. - * - * @return void */ - public function register() + public function register(): void { $this->mergeConfigFrom( - dirname(__DIR__) . '/config/playground-matrix-resource.php', + dirname(__DIR__).'/config/playground-matrix-resource.php', $this->package ); } - public function routes(array $config) + /** + * Set the application's policies from the configuration. + * + * @param array $policies + */ + 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.', + 'model' => is_string($model) ? $model : gettype($model), + 'policy' => is_string($policy) ? $policy : gettype($policy), + 'policies' => $policies, + ]); + + continue; + } + if (! is_string($policy) || ! class_exists($policy)) { + Log::error(__METHOD__, [ + 'error' => 'Expecting the policy to exist.', + 'model' => is_string($model) ? $model : gettype($model), + 'policy' => is_string($policy) ? $policy : gettype($policy), + 'policies' => $policies, + ]); + + continue; + } + $this->policies[$model] = $policy; + } + } + + /** + * @param array $config + */ + public function routes(array $config): void { - if (!empty($config['routes']['matrix'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/matrix.php'); + if (! empty($config['matrix'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/matrix.php'); } - if (!empty($config['routes']['backlogs'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/backlogs.php'); + if (! empty($config['backlogs'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/backlogs.php'); } - if (!empty($config['routes']['boards'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/boards.php'); + if (! empty($config['boards'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/boards.php'); } - if (!empty($config['routes']['epics'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/epics.php'); + if (! empty($config['epics'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/epics.php'); } - if (!empty($config['routes']['flows'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/flows.php'); + if (! empty($config['flows'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/flows.php'); } - if (!empty($config['routes']['milestones'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/milestones.php'); + if (! empty($config['milestones'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/milestones.php'); } - if (!empty($config['routes']['notes'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/notes.php'); + if (! empty($config['notes'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/notes.php'); } - if (!empty($config['routes']['projects'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/projects.php'); + if (! empty($config['projects'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/projects.php'); } - if (!empty($config['routes']['releases'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/releases.php'); + if (! empty($config['releases'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/releases.php'); } - if (!empty($config['routes']['roadmaps'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/roadmaps.php'); + if (! empty($config['roadmaps'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/roadmaps.php'); } - if (!empty($config['routes']['sources'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/sources.php'); + if (! empty($config['sources'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/sources.php'); } - if (!empty($config['routes']['sprints'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/sprints.php'); + if (! empty($config['sprints'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/sprints.php'); } - if (!empty($config['routes']['tags'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/tags.php'); + if (! empty($config['tags'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/tags.php'); } - if (!empty($config['routes']['teams'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/teams.php'); + if (! empty($config['teams'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/teams.php'); } - if (!empty($config['routes']['tickets'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/tickets.php'); + if (! empty($config['tickets'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/tickets.php'); } - if (!empty($config['routes']['versions'])) { - $this->loadRoutesFrom(dirname(__DIR__) . '/routes/versions.php'); + if (! empty($config['versions'])) { + $this->loadRoutesFrom(dirname(__DIR__).'/routes/versions.php'); } } - public function about() + public function about(): void { $config = config($this->package); + $config = is_array($config) ? $config : []; - $version = $this->version(); + $load = ! empty($config['load']) && is_array($config['load']) ? $config['load'] : []; + + $middleware = ! empty($config['middleware']) && is_array($config['middleware']) ? $config['middleware'] : []; - $redirect = defined('\App\Providers\RouteServiceProvider::HOME') ? \App\Providers\RouteServiceProvider::HOME : null; + $routes = ! empty($config['routes']) && is_array($config['routes']) ? $config['routes'] : []; + + $sitemap = ! empty($config['sitemap']) && is_array($config['sitemap']) ? $config['sitemap'] : []; + + $version = $this->version(); AboutCommand::add('Playground Matrix Resource', fn () => [ - 'Load Policies' => !empty($config['load']['policies']) ? 'ENABLED' : 'DISABLED', - 'Load Routes' => !empty($config['load']['routes']) ? 'ENABLED' : 'DISABLED', - 'Load Views' => !empty($config['load']['views']) ? 'ENABLED' : 'DISABLED', + 'Load Policies' => ! empty($load['policies']) ? 'ENABLED' : 'DISABLED', + 'Load Routes' => ! empty($load['routes']) ? 'ENABLED' : 'DISABLED', + 'Load Views' => ! empty($load['views']) ? 'ENABLED' : 'DISABLED', + 'Policy [namespace]' => sprintf('[%s]', $config['policy_namespace']), + + 'Middleware auth' => sprintf('%s', json_encode($middleware['auth'])), + 'Middleware default' => sprintf('%s', json_encode($middleware['default'])), + 'Middleware guest' => sprintf('%s', json_encode($middleware['guest'])), 'View [layout]' => sprintf('[%s]', $config['layout']), 'View [prefix]' => sprintf('[%s]', $config['view']), - 'Sitemap Views' => !empty($config['sitemap']['enable']) ? 'ENABLED' : 'DISABLED', - 'Sitemap Guest' => !empty($config['sitemap']['guest']) ? 'ENABLED' : 'DISABLED', - 'Sitemap User' => !empty($config['sitemap']['user']) ? 'ENABLED' : 'DISABLED', - 'Sitemap [view]' => sprintf('[%s]', $config['sitemap']['view']), - - 'Policy [Middleware]' => sprintf('[%s]', implode(', ', $config['middleware'])), - 'Policy [namespace]' => sprintf('[%s]', $config['policy_namespace']), + 'Sitemap Views' => ! empty($sitemap['enable']) ? 'ENABLED' : 'DISABLED', + 'Sitemap Guest' => ! empty($sitemap['guest']) ? 'ENABLED' : 'DISABLED', + 'Sitemap User' => ! empty($sitemap['user']) ? 'ENABLED' : 'DISABLED', + 'Sitemap [view]' => sprintf('[%s]', $sitemap['view']), + + 'Route matrix' => ! empty($routes['matrix']) ? 'ENABLED' : 'DISABLED', + 'Route backlogs' => ! empty($routes['backlogs']) ? 'ENABLED' : 'DISABLED', + 'Route boards' => ! empty($routes['boards']) ? 'ENABLED' : 'DISABLED', + 'Route epics' => ! empty($routes['epics']) ? 'ENABLED' : 'DISABLED', + 'Route flows' => ! empty($routes['flows']) ? 'ENABLED' : 'DISABLED', + 'Route milestones' => ! empty($routes['milestones']) ? 'ENABLED' : 'DISABLED', + 'Route notes' => ! empty($routes['notes']) ? 'ENABLED' : 'DISABLED', + 'Route projects' => ! empty($routes['projects']) ? 'ENABLED' : 'DISABLED', + 'Route releases' => ! empty($routes['releases']) ? 'ENABLED' : 'DISABLED', + 'Route roadmaps' => ! empty($routes['roadmaps']) ? 'ENABLED' : 'DISABLED', + 'Route sources' => ! empty($routes['sources']) ? 'ENABLED' : 'DISABLED', + 'Route sprints' => ! empty($routes['sprints']) ? 'ENABLED' : 'DISABLED', + 'Route tags' => ! empty($routes['tags']) ? 'ENABLED' : 'DISABLED', + 'Route teams' => ! empty($routes['teams']) ? 'ENABLED' : 'DISABLED', + 'Route tickets' => ! empty($routes['tickets']) ? 'ENABLED' : 'DISABLED', + 'Route versions' => ! empty($routes['versions']) ? 'ENABLED' : 'DISABLED', 'Package' => $this->package, 'Version' => $version, ]); } - public function version() + public function version(): string { return static::VERSION; } diff --git a/src/ServiceProviderTrait.php b/src/ServiceProviderTrait.php deleted file mode 100644 index a5b3471..0000000 --- a/src/ServiceProviderTrait.php +++ /dev/null @@ -1,78 +0,0 @@ -policy_namespace = $config['policy_namespace']; - } - - return $this->policy_namespace; - } - - public function registerPolicies_getRegister(string $policy): string - { - $register = $policy; - - if (!empty($this->policy_namespace)) { - // TODO test slashes with policies in App\Policies or another namespace. - $register = str_replace( - 'GammaMatrix\\Playground\\Matrix\\Resource', - $this->policy_namespace, - $policy - ); - } - - return $register; - } - - /** - * Register the application's policies. - * - * @return void - */ - public function registerPolicies() - { - foreach ($this->policies() as $model => $policy) { - - $register = null; - - if ($policy && is_string($policy)) { - $register = $this->registerPolicies_getRegister($policy); - } - - // dd([ - // '__METHOD__' => __METHOD__, - // '$model' => $model, - // '$register' => $register, - // '$this->policy_namespace' => $this->policy_namespace, - // ]); - - if ($register) { - Gate::policy($model, $register); - } - } - } -} diff --git a/tests/Feature/Http/Controllers/BacklogRouteTest.php b/tests/Feature/Http/Controllers/BacklogRouteTest.php index 3a68829..2fc0242 100644 --- a/tests/Feature/Http/Controllers/BacklogRouteTest.php +++ b/tests/Feature/Http/Controllers/BacklogRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Backlog', - 'model_label_plural' => 'Backlogs', - 'model_route' => 'playground.matrix.resource.backlogs', - 'model_slug' => 'backlog', - 'model_slug_plural' => 'backlogs', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Backlog', + 'model_label_plural' => 'Backlogs', + 'model_route' => 'playground.matrix.resource.backlogs', + 'model_slug' => 'backlog', + 'model_slug_plural' => 'backlogs', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:backlog', - 'table' => 'matrix_backlogs', - 'view' => 'playground-matrix-resource::backlog', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:backlog', + 'table' => 'matrix_backlogs', + 'view' => 'playground-matrix-resource::backlog', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class BacklogRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/BoardRouteTest.php b/tests/Feature/Http/Controllers/BoardRouteTest.php index 92b423f..eb21804 100644 --- a/tests/Feature/Http/Controllers/BoardRouteTest.php +++ b/tests/Feature/Http/Controllers/BoardRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Board', - 'model_label_plural' => 'Boards', - 'model_route' => 'playground.matrix.resource.boards', - 'model_slug' => 'board', - 'model_slug_plural' => 'boards', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Board', + 'model_label_plural' => 'Boards', + 'model_route' => 'playground.matrix.resource.boards', + 'model_slug' => 'board', + 'model_slug_plural' => 'boards', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:board', - 'table' => 'matrix_boards', - 'view' => 'playground-matrix-resource::board', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:board', + 'table' => 'matrix_boards', + 'view' => 'playground-matrix-resource::board', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class BoardRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/EpicRouteTest.php b/tests/Feature/Http/Controllers/EpicRouteTest.php index 6f74172..0b3b27b 100644 --- a/tests/Feature/Http/Controllers/EpicRouteTest.php +++ b/tests/Feature/Http/Controllers/EpicRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Epic', - 'model_label_plural' => 'Epics', - 'model_route' => 'playground.matrix.resource.epics', - 'model_slug' => 'epic', - 'model_slug_plural' => 'epics', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Epic', + 'model_label_plural' => 'Epics', + 'model_route' => 'playground.matrix.resource.epics', + 'model_slug' => 'epic', + 'model_slug_plural' => 'epics', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:epic', - 'table' => 'matrix_epics', - 'view' => 'playground-matrix-resource::epic', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:epic', + 'table' => 'matrix_epics', + 'view' => 'playground-matrix-resource::epic', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class EpicRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/FlowRouteTest.php b/tests/Feature/Http/Controllers/FlowRouteTest.php index 71bbcaf..d3d5965 100644 --- a/tests/Feature/Http/Controllers/FlowRouteTest.php +++ b/tests/Feature/Http/Controllers/FlowRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Flow', - 'model_label_plural' => 'Flows', - 'model_route' => 'playground.matrix.resource.flows', - 'model_slug' => 'flow', - 'model_slug_plural' => 'flows', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Flow', + 'model_label_plural' => 'Flows', + 'model_route' => 'playground.matrix.resource.flows', + 'model_slug' => 'flow', + 'model_slug_plural' => 'flows', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:flow', - 'table' => 'matrix_flows', - 'view' => 'playground-matrix-resource::flow', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:flow', + 'table' => 'matrix_flows', + 'view' => 'playground-matrix-resource::flow', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class FlowRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/MilestoneRouteTest.php b/tests/Feature/Http/Controllers/MilestoneRouteTest.php index 56f32e8..680da5e 100644 --- a/tests/Feature/Http/Controllers/MilestoneRouteTest.php +++ b/tests/Feature/Http/Controllers/MilestoneRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Milestone', - 'model_label_plural' => 'Milestones', - 'model_route' => 'playground.matrix.resource.milestones', - 'model_slug' => 'milestone', - 'model_slug_plural' => 'milestones', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Milestone', + 'model_label_plural' => 'Milestones', + 'model_route' => 'playground.matrix.resource.milestones', + 'model_slug' => 'milestone', + 'model_slug_plural' => 'milestones', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:milestone', - 'table' => 'matrix_milestones', - 'view' => 'playground-matrix-resource::milestone', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:milestone', + 'table' => 'matrix_milestones', + 'view' => 'playground-matrix-resource::milestone', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class MilestoneRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/NoteRouteTest.php b/tests/Feature/Http/Controllers/NoteRouteTest.php index 70c2d5e..c57b035 100644 --- a/tests/Feature/Http/Controllers/NoteRouteTest.php +++ b/tests/Feature/Http/Controllers/NoteRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Note', - 'model_label_plural' => 'Notes', - 'model_route' => 'playground.matrix.resource.notes', - 'model_slug' => 'note', - 'model_slug_plural' => 'notes', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Note', + 'model_label_plural' => 'Notes', + 'model_route' => 'playground.matrix.resource.notes', + 'model_slug' => 'note', + 'model_slug_plural' => 'notes', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:note', - 'table' => 'matrix_notes', - 'view' => 'playground-matrix-resource::note', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:note', + 'table' => 'matrix_notes', + 'view' => 'playground-matrix-resource::note', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class NoteRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/ProjectRouteTest.php b/tests/Feature/Http/Controllers/ProjectRouteTest.php index f47de09..70991e0 100644 --- a/tests/Feature/Http/Controllers/ProjectRouteTest.php +++ b/tests/Feature/Http/Controllers/ProjectRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Project', - 'model_label_plural' => 'Projects', - 'model_route' => 'playground.matrix.resource.projects', - 'model_slug' => 'project', - 'model_slug_plural' => 'projects', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Project', + 'model_label_plural' => 'Projects', + 'model_route' => 'playground.matrix.resource.projects', + 'model_slug' => 'project', + 'model_slug_plural' => 'projects', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:project', - 'table' => 'matrix_projects', - 'view' => 'playground-matrix-resource::project', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:project', + 'table' => 'matrix_projects', + 'view' => 'playground-matrix-resource::project', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class ProjectRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/ReleaseRouteTest.php b/tests/Feature/Http/Controllers/ReleaseRouteTest.php index 4cef32d..4424378 100644 --- a/tests/Feature/Http/Controllers/ReleaseRouteTest.php +++ b/tests/Feature/Http/Controllers/ReleaseRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Release', - 'model_label_plural' => 'Releases', - 'model_route' => 'playground.matrix.resource.releases', - 'model_slug' => 'release', - 'model_slug_plural' => 'releases', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Release', + 'model_label_plural' => 'Releases', + 'model_route' => 'playground.matrix.resource.releases', + 'model_slug' => 'release', + 'model_slug_plural' => 'releases', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:release', - 'table' => 'matrix_releases', - 'view' => 'playground-matrix-resource::release', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:release', + 'table' => 'matrix_releases', + 'view' => 'playground-matrix-resource::release', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class ReleaseRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/RoadmapRouteTest.php b/tests/Feature/Http/Controllers/RoadmapRouteTest.php index 0bbeff6..28800bc 100644 --- a/tests/Feature/Http/Controllers/RoadmapRouteTest.php +++ b/tests/Feature/Http/Controllers/RoadmapRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Roadmap', - 'model_label_plural' => 'Roadmaps', - 'model_route' => 'playground.matrix.resource.roadmaps', - 'model_slug' => 'roadmap', - 'model_slug_plural' => 'roadmaps', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Roadmap', + 'model_label_plural' => 'Roadmaps', + 'model_route' => 'playground.matrix.resource.roadmaps', + 'model_slug' => 'roadmap', + 'model_slug_plural' => 'roadmaps', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:roadmap', - 'table' => 'matrix_roadmaps', - 'view' => 'playground-matrix-resource::roadmap', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:roadmap', + 'table' => 'matrix_roadmaps', + 'view' => 'playground-matrix-resource::roadmap', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class RoadmapRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/SourceRouteTest.php b/tests/Feature/Http/Controllers/SourceRouteTest.php index fafe288..51c01f5 100644 --- a/tests/Feature/Http/Controllers/SourceRouteTest.php +++ b/tests/Feature/Http/Controllers/SourceRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Source', - 'model_label_plural' => 'Sources', - 'model_route' => 'playground.matrix.resource.sources', - 'model_slug' => 'source', - 'model_slug_plural' => 'sources', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Source', + 'model_label_plural' => 'Sources', + 'model_route' => 'playground.matrix.resource.sources', + 'model_slug' => 'source', + 'model_slug_plural' => 'sources', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:source', - 'table' => 'matrix_sources', - 'view' => 'playground-matrix-resource::source', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:source', + 'table' => 'matrix_sources', + 'view' => 'playground-matrix-resource::source', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class SourceRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/SprintRouteTest.php b/tests/Feature/Http/Controllers/SprintRouteTest.php index 99074cf..24e874a 100644 --- a/tests/Feature/Http/Controllers/SprintRouteTest.php +++ b/tests/Feature/Http/Controllers/SprintRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Sprint', - 'model_label_plural' => 'Sprints', - 'model_route' => 'playground.matrix.resource.sprints', - 'model_slug' => 'sprint', - 'model_slug_plural' => 'sprints', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Sprint', + 'model_label_plural' => 'Sprints', + 'model_route' => 'playground.matrix.resource.sprints', + 'model_slug' => 'sprint', + 'model_slug_plural' => 'sprints', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:sprint', - 'table' => 'matrix_sprints', - 'view' => 'playground-matrix-resource::sprint', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:sprint', + 'table' => 'matrix_sprints', + 'view' => 'playground-matrix-resource::sprint', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class SprintRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/TagRouteTest.php b/tests/Feature/Http/Controllers/TagRouteTest.php index d1b55b2..8c70317 100644 --- a/tests/Feature/Http/Controllers/TagRouteTest.php +++ b/tests/Feature/Http/Controllers/TagRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Tag', - 'model_label_plural' => 'Tags', - 'model_route' => 'playground.matrix.resource.tags', - 'model_slug' => 'tag', - 'model_slug_plural' => 'tags', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Tag', + 'model_label_plural' => 'Tags', + 'model_route' => 'playground.matrix.resource.tags', + 'model_slug' => 'tag', + 'model_slug_plural' => 'tags', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:tag', - 'table' => 'matrix_tags', - 'view' => 'playground-matrix-resource::tag', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:tag', + 'table' => 'matrix_tags', + 'view' => 'playground-matrix-resource::tag', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class TagRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/TeamRouteTest.php b/tests/Feature/Http/Controllers/TeamRouteTest.php index d217050..483bab3 100644 --- a/tests/Feature/Http/Controllers/TeamRouteTest.php +++ b/tests/Feature/Http/Controllers/TeamRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Team', - 'model_label_plural' => 'Teams', - 'model_route' => 'playground.matrix.resource.teams', - 'model_slug' => 'team', - 'model_slug_plural' => 'teams', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Team', + 'model_label_plural' => 'Teams', + 'model_route' => 'playground.matrix.resource.teams', + 'model_slug' => 'team', + 'model_slug_plural' => 'teams', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:team', - 'table' => 'matrix_teams', - 'view' => 'playground-matrix-resource::team', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:team', + 'table' => 'matrix_teams', + 'view' => 'playground-matrix-resource::team', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class TeamRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/TicketRouteTest.php b/tests/Feature/Http/Controllers/TicketRouteTest.php index 4e07ceb..f602941 100644 --- a/tests/Feature/Http/Controllers/TicketRouteTest.php +++ b/tests/Feature/Http/Controllers/TicketRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Ticket', - 'model_label_plural' => 'Tickets', - 'model_route' => 'playground.matrix.resource.tickets', - 'model_slug' => 'ticket', - 'model_slug_plural' => 'tickets', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Ticket', + 'model_label_plural' => 'Tickets', + 'model_route' => 'playground.matrix.resource.tickets', + 'model_slug' => 'ticket', + 'model_slug_plural' => 'tickets', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:ticket', - 'table' => 'matrix_tickets', - 'view' => 'playground-matrix-resource::ticket', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:ticket', + 'table' => 'matrix_tickets', + 'view' => 'playground-matrix-resource::ticket', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class TicketRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/Http/Controllers/VersionRouteTest.php b/tests/Feature/Http/Controllers/VersionRouteTest.php index 8f7eb99..f48b800 100644 --- a/tests/Feature/Http/Controllers/VersionRouteTest.php +++ b/tests/Feature/Http/Controllers/VersionRouteTest.php @@ -1,46 +1,50 @@ + */ public array $packageInfo = [ - 'model_attribute' => 'label', - 'model_label' => 'Version', - 'model_label_plural' => 'Versions', - 'model_route' => 'playground.matrix.resource.versions', - 'model_slug' => 'version', - 'model_slug_plural' => 'versions', - 'module_label' => 'Matrix', + 'model_attribute' => 'label', + 'model_label' => 'Version', + 'model_label_plural' => 'Versions', + 'model_route' => 'playground.matrix.resource.versions', + 'model_slug' => 'version', + 'model_slug_plural' => 'versions', + 'module_label' => 'Matrix', 'module_label_plural' => 'Matrices', - 'module_route' => 'playground.matrix.resource', - 'module_slug' => 'matrix', - 'privilege' => 'playground-matrix-resource:version', - 'table' => 'matrix_versions', - 'view' => 'playground-matrix-resource::version', + 'module_route' => 'playground.matrix.resource', + 'module_slug' => 'matrix', + 'privilege' => 'playground-matrix-resource:version', + 'table' => 'matrix_versions', + 'view' => 'playground-matrix-resource::version', ]; + /** + * @var array + */ protected $structure_data = [ 'data' => [ 'id', @@ -140,6 +144,9 @@ class VersionRouteTest extends TestCase ], ]; + /** + * @var array + */ protected $structure_index = [ 'data' => [ // This can be overriden with $structure_data diff --git a/tests/Feature/TestCase.php b/tests/Feature/TestCase.php index 0687c10..a073cda 100644 --- a/tests/Feature/TestCase.php +++ b/tests/Feature/TestCase.php @@ -1,18 +1,15 @@ __METHOD__, // 'path' => dirname(dirname(__DIR__)) . '/database/migrations', // ]); - if (!empty(env('TEST_DB_MIGRATIONS'))) { + if (! empty(env('TEST_DB_MIGRATIONS'))) { // $this->loadLaravelMigrations(); - $this->loadMigrationsFrom(dirname(dirname(__DIR__)) . '/database/migrations-laravel'); - $this->loadMigrationsFrom(dirname(dirname(__DIR__)) . '/database/migrations-matrix-uuid'); + $this->loadMigrationsFrom(dirname(dirname(__DIR__)).'/database/migrations-laravel'); + $this->loadMigrationsFrom(dirname(dirname(__DIR__)).'/database/migrations-matrix-uuid'); } } } diff --git a/tests/Unit/Http/Requests/Backlog/CreateRequestTest.php b/tests/Unit/Http/Requests/Backlog/CreateRequestTest.php index d6f7166..7e007ee 100644 --- a/tests/Unit/Http/Requests/Backlog/CreateRequestTest.php +++ b/tests/Unit/Http/Requests/Backlog/CreateRequestTest.php @@ -1,18 +1,18 @@ policyClass; - - $instance = new $policyClass(); + $instance = new BacklogPolicy; - $this->assertInstanceOf($policyClass, $instance); + $this->assertInstanceOf(BacklogPolicy::class, $instance); } } diff --git a/tests/Unit/ServiceProviderTrait/TraitTest.php b/tests/Unit/ServiceProviderTrait/TraitTest.php deleted file mode 100644 index d1f0349..0000000 --- a/tests/Unit/ServiceProviderTrait/TraitTest.php +++ /dev/null @@ -1,83 +0,0 @@ -mock = $this->getMockForTrait( - static::TRAIT_CLASS, - [], - '', - true, - true, - true, - $methods = [] - ); - } - - public function test_setPolicyNamespace_with_invalid_value(): void - { - $expected = ''; - - $this->assertSame($expected, $this->mock->setPolicyNamespace([])); - } - - public function test_setPolicyNamespace_with_app_namespace(): void - { - $expected = 'App\\Policies'; - - $config = [ - 'policy_namespace' => $expected, - ]; - - $this->assertSame($expected, $this->mock->setPolicyNamespace($config)); - } - - public function test_registerPolicies_getRegister_with_empty_policy_namespace(): void - { - $policy_namespace = ''; - $this->setProtected($this->mock, 'policy_namespace', $policy_namespace); - - $policy = \GammaMatrix\Playground\Matrix\Resource\Policies\BacklogPolicy::class; - $expected = $policy; - - $this->assertSame($expected, $this->mock->registerPolicies_getRegister($policy)); - } - - public function test_registerPolicies_getRegister_with_app_policy_namespace(): void - { - $policy_namespace = 'App\\Policies'; - $this->setProtected($this->mock, 'policy_namespace', $policy_namespace); - - $policy = 'App\\\Policies\\\BacklogPolicy'; - $expected = $policy; - - $this->assertSame($expected, $this->mock->registerPolicies_getRegister($policy)); - } -} diff --git a/tests/Unit/TestCase.php b/tests/Unit/TestCase.php index 6c5ed6a..24e13ee 100644 --- a/tests/Unit/TestCase.php +++ b/tests/Unit/TestCase.php @@ -1,15 +1,15 @@ set('auth.providers.users.model', 'GammaMatrix\\Playground\\Test\\Models\\User'); - $app['config']->set('playground.user', 'GammaMatrix\\Playground\\Test\\Models\\User'); + $app['config']->set('auth.providers.users.model', 'Playground\\Test\\Models\\User'); + $app['config']->set('playground.user', 'Playground\\Test\\Models\\User'); $app['config']->set('playground.auth.verify', 'user'); $app['config']->set('playground-matrix.load.migrations', true);