Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Cendekia Pramana Putra committed Oct 1, 2018
2 parents e735c5f + 6a601b0 commit 1b8db9c
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 34 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Latest Version on Packagist](https://img.shields.io/packagist/v/cendekia/nova-setting-tool.svg?style=flat-square)](https://packagist.org/packages/cendekia/nova-setting-tool)
[![Build Status](https://img.shields.io/travis/cendekia/nova-setting-tool/master.svg?style=flat-square)](https://travis-ci.org/cendekia/nova-setting-tool)
[![StyleCI](https://github.styleci.io/repos/149705913/shield?branch=master)](https://github.styleci.io/repos/149705913)
[![Total Downloads](https://img.shields.io/packagist/dt/cendekia/nova-setting-tool.svg?style=flat-square)](https://packagist.org/packages/cendekia/nova-setting-tool)

A Laravel Nova package that can change the basic admin panel settings, i.e app title, copyright texts, app version and etc by overriding the default Laravel Nova template which hopefully could help developer when starting their projects without having doing simple stuff over and over again.
Expand Down
12 changes: 6 additions & 6 deletions config/nova_setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
'copyright' => [
'year' => date('Y'),
'owner' => 'John Doe',
'text' => 'All rights reserved'
'text' => 'All rights reserved',
],
'version' => "0.0.1",
'logo' => null
'version' => '0.0.1',
'logo' => null,
],
'admin' => [
'name' => config('nova.name'),
'url' => config('nova.url').config('nova.path'),
'copyright' => [
'year' => date('Y'),
'owner' => 'Laravel LLC',
'text' => 'By Taylor Otwell, David Hemphill, and Steve Schoger.'
'text' => 'By Taylor Otwell, David Hemphill, and Steve Schoger.',
],
'version' => Laravel\Nova\Nova::version(),
'logo' => null
]
'logo' => null,
],
];
1 change: 0 additions & 1 deletion routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@
Route::get('/install-setting', 'Cendekia\SettingTool\Http\Controllers\InstallationController@run');
Route::get('/default-setting', 'Cendekia\SettingTool\Http\Controllers\DefaultSettingController@run');
Route::put('/update-setting', 'Cendekia\SettingTool\Http\Controllers\UpdateSettingController@run');

4 changes: 2 additions & 2 deletions src/Boostrap/InitSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

namespace Cendekia\SettingTool\Bootstrap;

class InitSetting {

class InitSetting
{
}
8 changes: 4 additions & 4 deletions src/Http/Controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Cendekia\SettingTool\Http\Controllers;

use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;

class BaseController
{
Expand All @@ -15,13 +15,13 @@ class BaseController
protected $message = [];

/**
* Response setting
* Response setting.
* @var string
*/
protected $setting;

/**
* Response status
* Response status.
* @var string
*/
protected $statusCode = 200;
Expand All @@ -37,7 +37,7 @@ public function run(Request $request): JsonResponse

return response()->json([
'message' => $this->message,
'setting' => $this->setting
'setting' => $this->setting,
], $this->statusCode);
}
}
7 changes: 3 additions & 4 deletions src/Http/Controllers/DefaultSettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Cendekia\SettingTool\Http\Controllers;

use Cendekia\SettingTool\Http\Controllers\BaseController;
use Unisharp\Setting\Setting;

class DefaultSettingController extends BaseController
Expand All @@ -13,8 +12,9 @@ public function __construct(Setting $tool)
{
$this->tool = $tool;
}

/**
* Load setting
* Load setting.
* @return void
*/
protected function process($request): void
Expand All @@ -28,9 +28,8 @@ protected function process($request): void
// hack to prevent url from being edited
$this->setting['app']['url'] = config('nova_setting.app.url');
$this->setting['admin']['url'] = config('nova_setting.admin.url');

} catch (\Exception $e) {
$this->message = "Uh-oh, unable to load setting.";
$this->message = 'Uh-oh, unable to load setting.';
$this->statusCode = 400;
}
}
Expand Down
11 changes: 5 additions & 6 deletions src/Http/Controllers/InstallationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@

namespace Cendekia\SettingTool\Http\Controllers;

use Cendekia\SettingTool\Http\Controllers\BaseController;
use Cendekia\SettingTool\Migrations\AlterSettingTableMigration;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Artisan;
use Cendekia\SettingTool\Migrations\AlterSettingTableMigration;

class InstallationController extends BaseController
{
/**
* [process description]
* [process description].
* @return void
*/
protected function process(): void
{
try {
Artisan::call('migrate');
} catch (\Exception $e) {
$this->message = "Unable to created settings table.";
$this->message = 'Unable to created settings table.';
$this->statusCode = 500;
}

Expand All @@ -27,9 +26,9 @@ protected function process(): void

try {
$migration->up();
$this->message = "The setting tool has been successfully installed. . The page will refresh in few seconds...";
$this->message = 'The setting tool has been successfully installed. . The page will refresh in few seconds...';
} catch (\Exception $e) {
$this->message = "Unable to update settings table.";
$this->message = 'Unable to update settings table.';
$this->statusCode = 500;
}
}
Expand Down
11 changes: 4 additions & 7 deletions src/Http/Controllers/UpdateSettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

namespace Cendekia\SettingTool\Http\Controllers;

use Cendekia\SettingTool\Http\Controllers\BaseController;
use Cendekia\SettingTool\Migrations\AlterSettingTableMigration;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Artisan;
use Unisharp\Setting\Setting;

class UpdateSettingController extends BaseController
Expand All @@ -16,8 +12,9 @@ public function __construct(Setting $tool)
{
$this->tool = $tool;
}

/**
* Update setting
* Update setting.
* @return void
*/
protected function process($request): void
Expand All @@ -31,9 +28,9 @@ protected function process($request): void
'admin' => $this->tool->get('admin') ?? config('nova_setting.admin'),
];

$this->message = "The setting was updated. The page will refresh in few seconds...";
$this->message = 'The setting was updated. The page will refresh in few seconds...';
} catch (\Exception $e) {
$this->message = "Uh-oh, unable to update setting.";
$this->message = 'Uh-oh, unable to update setting.';
$this->statusCode = 400;
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/ToolServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

namespace Cendekia\SettingTool;

use Cendekia\SettingTool\Http\Middleware\Authorize;
use Laravel\Nova\Nova;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use Laravel\Nova\Events\ServingNova;
use Laravel\Nova\Nova;
use Cendekia\SettingTool\Http\Middleware\Authorize;

class ToolServiceProvider extends ServiceProvider
{
Expand Down Expand Up @@ -45,7 +44,6 @@ protected function routes()
->group(__DIR__.'/../routes/api.php');
}


/**
* Register any application services.
* @return void
Expand Down

0 comments on commit 1b8db9c

Please sign in to comment.