Skip to content

Commit

Permalink
Merge pull request #354 from ARCANEDEV/patch-routes
Browse files Browse the repository at this point in the history
Cleaning the routes
  • Loading branch information
arcanedev-maroc authored Jul 6, 2020
2 parents e360397 + ddd9a41 commit 46643ff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
21 changes: 10 additions & 11 deletions src/Http/Routes/LogViewerRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Arcanedev\LogViewer\Http\Routes;

use Arcanedev\LogViewer\Http\Controllers\LogViewerController;
use Arcanedev\Support\Routing\RouteRegistrar;

/**
Expand All @@ -26,14 +27,12 @@ class LogViewerRoute extends RouteRegistrar
*/
public function map(): void
{
$attributes = array_merge(config('log-viewer.route.attributes', []), [
'namespace' => 'Arcanedev\\LogViewer\\Http\\Controllers',
]);
$attributes = (array) config('log-viewer.route.attributes');

$this->group($attributes, function() {
$this->name('log-viewer::')->group(function () {
// log-viewer::dashboard
$this->get('/', 'LogViewerController@index')->name('dashboard');
$this->get('/', [LogViewerController::class, 'index'])
->name('dashboard'); // log-viewer::dashboard

$this->mapLogsRoutes();
});
Expand All @@ -46,23 +45,23 @@ public function map(): void
private function mapLogsRoutes(): void
{
$this->prefix('logs')->name('logs.')->group(function() {
$this->get('/', 'LogViewerController@listLogs')
$this->get('/', [LogViewerController::class, 'listLogs'])
->name('list'); // log-viewer::logs.list

$this->delete('delete', 'LogViewerController@delete')
$this->delete('delete', [LogViewerController::class, 'delete'])
->name('delete'); // log-viewer::logs.delete

$this->prefix('{date}')->group(function() {
$this->get('/', 'LogViewerController@show')
$this->get('/', [LogViewerController::class, 'show'])
->name('show'); // log-viewer::logs.show

$this->get('download', 'LogViewerController@download')
$this->get('download', [LogViewerController::class, 'download'])
->name('download'); // log-viewer::logs.download

$this->get('{level}', 'LogViewerController@showByLevel')
$this->get('{level}', [LogViewerController::class, 'showByLevel'])
->name('filter'); // log-viewer::logs.filter

$this->get('{level}/search', 'LogViewerController@search')
$this->get('{level}/search', [LogViewerController::class, 'search'])
->name('search'); // log-viewer::logs.search
});
});
Expand Down
4 changes: 1 addition & 3 deletions src/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ class RouteServiceProvider extends ServiceProvider
*/
public function routeAttributes()
{
return array_merge($this->config('attributes', []), [
'namespace' => 'Arcanedev\\LogViewer\\Http\\Controllers',
]);
return (array) $this->config('attributes');
}

/**
Expand Down

0 comments on commit 46643ff

Please sign in to comment.