Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gammamatrix committed May 21, 2024
1 parent 10e04b9 commit 3d6b6f4
Show file tree
Hide file tree
Showing 152 changed files with 1,562 additions and 318 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"preferred-install": {
"gammamatrix/*": "source",
"*": "dist"
}
},
"process-timeout": 0
},
"extra": {
"branch-alias": {
Expand All @@ -64,7 +65,7 @@
}
},
"scripts": {
"test": "vendor/bin/phpunit",
"test": "vendor/bin/testbench package:test",
"format": "vendor/bin/php-cs-fixer fix",
"analyse": "vendor/bin/phpstan analyse --verbose --debug --level max"
}
Expand Down
93 changes: 88 additions & 5 deletions config/playground-matrix-resource.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,72 @@
<?php
/**
* Playground
*/

declare(strict_types=1);

/**
* Playground: Matrix Resource Configuration and Environment Variables
*/
return [

/*
|---------------------------------------------------------------------------
| About Information
|---------------------------------------------------------------------------
|
| By default, information will be displayed about this package when using:
|
| `artisan about`
|
*/

'about' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ABOUT', true),

/*
|---------------------------------------------------------------------------
| Loading
|---------------------------------------------------------------------------
|
| By default, translations and views are loaded.
|
*/

'load' => [
'policies' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_POLICIES', true),
'routes' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_ROUTES', true),
'translations' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_TRANSLATIONS', false),
'views' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_VIEWS', true),
],

/*
|---------------------------------------------------------------------------
| Middleware
|---------------------------------------------------------------------------
|
|
*/

'middleware' => [
'default' => env('PLAYGROUND_MATRIX_RESOURCE_MIDDLEWARE_DEFAULT', ['web']),
'auth' => env('PLAYGROUND_MATRIX_RESOURCE_MIDDLEWARE_AUTH', ['web', 'auth']),
'guest' => env('PLAYGROUND_MATRIX_RESOURCE_MIDDLEWARE_GUEST', ['web']),
],

/*
|---------------------------------------------------------------------------
| Policies
|---------------------------------------------------------------------------
|
|
*/

'policies' => [
Playground\Matrix\Models\Backlog::class => Playground\Matrix\Resource\Policies\BacklogPolicy::class,
Playground\Matrix\Models\Board::class => Playground\Matrix\Resource\Policies\BoardPolicy::class,
Playground\Matrix\Models\Epic::class => Playground\Matrix\Resource\Policies\EpicPolicy::class,
Playground\Matrix\Models\Flow::class => Playground\Matrix\Resource\Policies\FlowPolicy::class,
Playground\Matrix\Models\Matrix::class => Playground\Matrix\Resource\Policies\MatrixPolicy::class,
Playground\Matrix\Models\Milestone::class => Playground\Matrix\Resource\Policies\MilestonePolicy::class,
Playground\Matrix\Models\Note::class => Playground\Matrix\Resource\Policies\NotePolicy::class,
Playground\Matrix\Models\Project::class => Playground\Matrix\Resource\Policies\ProjectPolicy::class,
Expand All @@ -26,11 +79,15 @@
Playground\Matrix\Models\Ticket::class => Playground\Matrix\Resource\Policies\TicketPolicy::class,
Playground\Matrix\Models\Version::class => Playground\Matrix\Resource\Policies\VersionPolicy::class,
],
'load' => [
'policies' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_POLICIES', true),
'routes' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_ROUTES', true),
'views' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_LOAD_VIEWS', true),
],

/*
|---------------------------------------------------------------------------
| Routes
|---------------------------------------------------------------------------
|
|
*/

'routes' => [
'matrix' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_MATRIX', true),
'backlogs' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_BACKLOGS', true),
Expand All @@ -50,14 +107,40 @@
'tickets' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_TICKETS', true),
'versions' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_ROUTES_VERSIONS', true),
],

/*
|---------------------------------------------------------------------------
| Sitemap
|---------------------------------------------------------------------------
|
|
*/

'sitemap' => [
'enable' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_SITEMAP_ENABLE', true),
'guest' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_SITEMAP_GUEST', true),
'user' => (bool) env('PLAYGROUND_MATRIX_RESOURCE_SITEMAP_USER', true),
'view' => env('PLAYGROUND_MATRIX_RESOURCE_SITEMAP_VIEW', 'playground-matrix-resource::sitemap'),
],

/*
|---------------------------------------------------------------------------
| Templates
|---------------------------------------------------------------------------
|
|
*/

'blade' => env('PLAYGROUND_MATRIX_RESOURCE_BLADE', 'playground-matrix-resource::'),

/*
|--------------------------------------------------------------------------
| Abilities
|--------------------------------------------------------------------------
|
|
*/

'abilities' => [
'admin' => [
'playground-matrix-resource:*',
Expand Down
26 changes: 26 additions & 0 deletions src/Http/Controllers/BacklogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ public function destroy(

$validated = $request->validated();

$user = $request->user();

if ($user?->id) {
$backlog->modified_by_id = $user->id;
}

if (empty($validated['force'])) {
$backlog->delete();
} else {
Expand Down Expand Up @@ -185,6 +191,10 @@ public function lock(

$user = $request->user();

if ($user?->id) {
$backlog->modified_by_id = $user->id;
}

$backlog->locked = true;

$backlog->save();
Expand Down Expand Up @@ -298,6 +308,10 @@ public function restore(

$user = $request->user();

if ($user?->id) {
$backlog->modified_by_id = $user->id;
}

$backlog->restore();

if ($request->expectsJson()) {
Expand Down Expand Up @@ -368,6 +382,10 @@ public function store(

$backlog = new Backlog($validated);

if ($user?->id) {
$backlog->created_by_id = $user->id;
}

$backlog->save();

if ($request->expectsJson()) {
Expand Down Expand Up @@ -402,6 +420,10 @@ public function unlock(

$backlog->locked = false;

if ($user?->id) {
$backlog->modified_by_id = $user->id;
}

$backlog->save();

if ($request->expectsJson()) {
Expand Down Expand Up @@ -436,6 +458,10 @@ public function update(

$backlog->update($validated);

if ($user?->id) {
$backlog->modified_by_id = $user->id;
}

if ($request->expectsJson()) {
return (new Resources\Backlog($backlog))->response($request);
}
Expand Down
26 changes: 26 additions & 0 deletions src/Http/Controllers/BoardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ public function destroy(

$validated = $request->validated();

$user = $request->user();

if ($user?->id) {
$board->modified_by_id = $user->id;
}

if (empty($validated['force'])) {
$board->delete();
} else {
Expand Down Expand Up @@ -185,6 +191,10 @@ public function lock(

$user = $request->user();

if ($user?->id) {
$board->modified_by_id = $user->id;
}

$board->locked = true;

$board->save();
Expand Down Expand Up @@ -298,6 +308,10 @@ public function restore(

$user = $request->user();

if ($user?->id) {
$board->modified_by_id = $user->id;
}

$board->restore();

if ($request->expectsJson()) {
Expand Down Expand Up @@ -368,6 +382,10 @@ public function store(

$board = new Board($validated);

if ($user?->id) {
$board->created_by_id = $user->id;
}

$board->save();

if ($request->expectsJson()) {
Expand Down Expand Up @@ -402,6 +420,10 @@ public function unlock(

$board->locked = false;

if ($user?->id) {
$board->modified_by_id = $user->id;
}

$board->save();

if ($request->expectsJson()) {
Expand Down Expand Up @@ -436,6 +458,10 @@ public function update(

$board->update($validated);

if ($user?->id) {
$board->modified_by_id = $user->id;
}

if ($request->expectsJson()) {
return (new Resources\Board($board))->response($request);
}
Expand Down
26 changes: 26 additions & 0 deletions src/Http/Controllers/EpicController.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,12 @@ public function destroy(

$validated = $request->validated();

$user = $request->user();

if ($user?->id) {
$epic->modified_by_id = $user->id;
}

if (empty($validated['force'])) {
$epic->delete();
} else {
Expand Down Expand Up @@ -185,6 +191,10 @@ public function lock(

$user = $request->user();

if ($user?->id) {
$epic->modified_by_id = $user->id;
}

$epic->locked = true;

$epic->save();
Expand Down Expand Up @@ -298,6 +308,10 @@ public function restore(

$user = $request->user();

if ($user?->id) {
$epic->modified_by_id = $user->id;
}

$epic->restore();

if ($request->expectsJson()) {
Expand Down Expand Up @@ -368,6 +382,10 @@ public function store(

$epic = new Epic($validated);

if ($user?->id) {
$epic->created_by_id = $user->id;
}

$epic->save();

if ($request->expectsJson()) {
Expand Down Expand Up @@ -402,6 +420,10 @@ public function unlock(

$epic->locked = false;

if ($user?->id) {
$epic->modified_by_id = $user->id;
}

$epic->save();

if ($request->expectsJson()) {
Expand Down Expand Up @@ -436,6 +458,10 @@ public function update(

$epic->update($validated);

if ($user?->id) {
$epic->modified_by_id = $user->id;
}

if ($request->expectsJson()) {
return (new Resources\Epic($epic))->response($request);
}
Expand Down
Loading

0 comments on commit 3d6b6f4

Please sign in to comment.