Skip to content

Commit

Permalink
Merge branch 'release/5.3.7'
Browse files Browse the repository at this point in the history
* release/5.3.7:
  fixes #692
  Apply fixes from StyleCI (#689)
  refactored the route group
  • Loading branch information
austintoddj committed Apr 2, 2020
2 parents db3f6df + 8a713c4 commit 0d57521
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- laravel: ^6.0
testbench: ^4.0

name: PHP ${{ matrix.php }} on Laravel ${{ matrix.laravel }}
name: Laravel ${{ matrix.laravel }} on PHP ${{ matrix.php }}

steps:
- name: Checkout package
Expand Down
19 changes: 1 addition & 18 deletions src/CanvasServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Canvas\Console\PublishCommand;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Events\Dispatcher;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;

class CanvasServiceProvider extends ServiceProvider
Expand Down Expand Up @@ -73,23 +72,7 @@ private function registerEvents()
*/
private function registerRoutes()
{
Route::group($this->routeConfiguration(), function () {
$this->loadRoutesFrom(__DIR__.'/Http/routes.php');
});
}

/**
* Get the Canvas route group configuration array.
*
* @return array
*/
private function routeConfiguration()
{
return [
'namespace' => 'Canvas\Http\Controllers',
'prefix' => config('canvas.path'),
'middleware' => config('canvas.middleware'),
];
$this->loadRoutesFrom(__DIR__.'/Http/routes.php');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/PostController.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function store(string $id): JsonResponse
'alpha_dash',
Rule::unique('canvas_posts')->where(function ($query) use ($data) {
return $query->where('slug', $data['slug'])->where('user_id', $data['user_id']);
})->ignore($id),
})->ignore($this->isNewPost($id) ? null : $id),
],
], $messages)->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function store(string $id): JsonResponse
'alpha_dash',
Rule::unique('canvas_tags')->where(function ($query) use ($data) {
return $query->where('slug', $data['slug'])->where('user_id', $data['user_id']);
})->ignore($id)->whereNull('deleted_at'),
})->ignore($this->isNewTag($id) ? null : $id)->whereNull('deleted_at'),
],
], $messages)->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/TopicController.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function store(string $id): JsonResponse
'alpha_dash',
Rule::unique('canvas_topics')->where(function ($query) use ($data) {
return $query->where('slug', $data['slug'])->where('user_id', $data['user_id']);
})->ignore($id)->whereNull('deleted_at'),
})->ignore($this->isNewTopic($id) ? null : $id)->whereNull('deleted_at'),
],
], $messages)->validate();

Expand Down
86 changes: 45 additions & 41 deletions src/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,50 @@

use Illuminate\Support\Facades\Route;

Route::prefix('api')->group(function () {
Route::prefix('stats')->group(function () {
Route::get('/', 'StatsController@index');
Route::get('{id}', 'StatsController@show');
});

Route::prefix('posts')->group(function () {
Route::get('/', 'PostController@index');
Route::get('{id?}', 'PostController@show');
Route::post('{id}', 'PostController@store');
Route::delete('{id}', 'PostController@destroy');
});

Route::prefix('tags')->group(function () {
Route::get('/', 'TagController@index');
Route::get('{id?}', 'TagController@show');
Route::post('{id}', 'TagController@store');
Route::delete('{id}', 'TagController@destroy');
});

Route::prefix('topics')->group(function () {
Route::get('/', 'TopicController@index');
Route::get('{id?}', 'TopicController@show');
Route::post('{id}', 'TopicController@store');
Route::delete('{id}', 'TopicController@destroy');
});

Route::prefix('media')->group(function () {
Route::post('uploads', 'MediaController@store');
Route::delete('uploads', 'MediaController@destroy');
});

Route::prefix('settings')->group(function () {
Route::get('/', 'SettingsController@show');
Route::post('/', 'SettingsController@update');
});

Route::prefix('locale')->group(function () {
Route::post('/', 'LocaleController@update');
Route::namespace('Canvas\Http\Controllers')->group(function () {
Route::prefix(config('canvas.path'))->middleware(config('canvas.middleware'))->group(function () {
Route::prefix('api')->group(function () {
Route::prefix('stats')->group(function () {
Route::get('/', 'StatsController@index');
Route::get('{id}', 'StatsController@show');
});

Route::prefix('posts')->group(function () {
Route::get('/', 'PostController@index');
Route::get('{id?}', 'PostController@show');
Route::post('{id}', 'PostController@store');
Route::delete('{id}', 'PostController@destroy');
});

Route::prefix('tags')->group(function () {
Route::get('/', 'TagController@index');
Route::get('{id?}', 'TagController@show');
Route::post('{id}', 'TagController@store');
Route::delete('{id}', 'TagController@destroy');
});

Route::prefix('topics')->group(function () {
Route::get('/', 'TopicController@index');
Route::get('{id?}', 'TopicController@show');
Route::post('{id}', 'TopicController@store');
Route::delete('{id}', 'TopicController@destroy');
});

Route::prefix('media')->group(function () {
Route::post('uploads', 'MediaController@store');
Route::delete('uploads', 'MediaController@destroy');
});

Route::prefix('settings')->group(function () {
Route::get('/', 'SettingsController@show');
Route::post('/', 'SettingsController@update');
});

Route::prefix('locale')->group(function () {
Route::post('/', 'LocaleController@update');
});
});

Route::get('/{view?}', 'ViewController')->where('view', '(.*)')->name('canvas');
});
});

Route::get('/{view?}', 'ViewController')->where('view', '(.*)')->name('canvas');
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2531,9 +2531,9 @@ [email protected]:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=

electron-to-chromium@^1.3.390:
version "1.3.390"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.390.tgz#a49e67dea22e52ea8027c475dd5447b1c00b1d4e"
integrity sha512-4RvbM5x+002gKI8sltkqWEk5pptn0UnzekUx8RTThAMPDSb8jjpm6SwGiSnEve7f85biyZl8DMXaipaCxDjXag==
version "1.3.393"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.393.tgz#d13fa4cbf5065e18451c84465d22aef6aca9a911"
integrity sha512-Ko3/VdhZAaMaJBLBFqEJ+M1qMiBI8sJfPY/hSJvDrkB3Do8LJsL9tmXy4w7o9nPXif/jFaZGSlXTQWU8XVsYtg==

elliptic@^6.0.0:
version "6.5.2"
Expand Down Expand Up @@ -4017,9 +4017,9 @@ isobject@^3.0.0, isobject@^3.0.1:
integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8=

jest-worker@^25.1.0:
version "25.2.1"
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-25.2.1.tgz#209617015c768652646aa33a7828cc2ab472a18a"
integrity sha512-IHnpekk8H/hCUbBlfeaPZzU6v75bqwJp3n4dUrQuQOAgOneI4tx3jV2o8pvlXnDfcRsfkFIUD//HWXpCmR+evQ==
version "25.2.6"
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-25.2.6.tgz#d1292625326794ce187c38f51109faced3846c58"
integrity sha512-FJn9XDUSxcOR4cwDzRfL1z56rUofNTFs539FGASpd50RHdb6EVkhxQqktodW2mI49l+W3H+tFJDotCHUQF6dmA==
dependencies:
merge-stream "^2.0.0"
supports-color "^7.0.0"
Expand Down Expand Up @@ -6736,9 +6736,9 @@ terser@^3.11.0:
source-map-support "~0.5.10"

terser@^4.1.2, terser@^4.4.3:
version "4.6.9"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.6.9.tgz#deec3d8c4536461f46392e4d457bcd1ba2ab1212"
integrity sha512-9UuZOApK4oiTpX4AjnWhTCY3fCqntS3ggPQOku9M3Rvr70VETYsuHjSGuRy0D7X/Z994hfnzMy6TQ/H0WQSmXQ==
version "4.6.10"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.6.10.tgz#90f5bd069ff456ddbc9503b18e52f9c493d3b7c2"
integrity sha512-qbF/3UOo11Hggsbsqm2hPa6+L4w7bkr+09FNseEe8xrcVD3APGLFqE+Oz1ZKAxjYnFsj80rLOfgAtJ0LNJjtTA==
dependencies:
commander "^2.20.0"
source-map "~0.6.1"
Expand Down

0 comments on commit 0d57521

Please sign in to comment.