Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
Krato authored and StyleCIBot committed Nov 22, 2018
1 parent cdd795b commit 35b472e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
14 changes: 7 additions & 7 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
| by your tool's "Authorize" middleware by default. Now, go build!
|
*/
Route::any('/get-tables', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class . '@getTables');
Route::any('/get-columns', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class . '@getColumns');
Route::post('/check-file', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class . '@checkFile');
Route::post('/generate-resource', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class . '@generateFile');
Route::any('/get-tables', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class.'@getTables');
Route::any('/get-columns', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class.'@getColumns');
Route::post('/check-file', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class.'@checkFile');
Route::post('/generate-resource', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class.'@generateFile');

Route::get('/settings-get', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorOptionsController::class . '@getSettings');
Route::post('/settings-set', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorOptionsController::class . '@setSettings');
Route::post('/settings-reset', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorOptionsController::class . '@resetDefault');
Route::get('/settings-get', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorOptionsController::class.'@getSettings');
Route::post('/settings-set', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorOptionsController::class.'@setSettings');
Route::post('/settings-reset', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorOptionsController::class.'@resetDefault');
12 changes: 6 additions & 6 deletions src/Http/Controllers/ResourceGeneratorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Cloudstudio\ResourceGenerator\Http\Controllers;

use Cloudstudio\ResourceGenerator\Http\Services\GeneratorFunctions;
use Cloudstudio\ResourceGenerator\Http\Services\ResourceGeneratorService;
use Cloudstudio\ResourceGenerator\Http\Services\Settings;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Cloudstudio\ResourceGenerator\Http\Services\Settings;
use Cloudstudio\ResourceGenerator\Http\Services\GeneratorFunctions;
use Cloudstudio\ResourceGenerator\Http\Services\ResourceGeneratorService;

class ResourceGeneratorController extends Controller
{
Expand Down Expand Up @@ -38,8 +38,8 @@ public function checkFile(Request $request)
{
if ($request->has('createModel')) {
$modelNamespace = $this->setting->getSettings()->namespace->value;
$last = substr($modelNamespace, -1);
($last == '\\') ? $modelNamespace : $modelNamespace . '\\';
$last = substr($modelNamespace, -1);
($last == '\\') ? $modelNamespace : $modelNamespace.'\\';

$model = $this->checkIfFileExist($modelNamespace, $request->get('singular'));
}
Expand Down Expand Up @@ -97,7 +97,7 @@ public function generateModel($data, $namespace)
public function generateFile(Request $request)
{
$namespace = $this->setting->value('namespace');
$resource = $this->setting->value('resource');
$resource = $this->setting->value('resource');

$this->generateResource($request, $this->getNamespace(), $namespace, $resource);

Expand Down
10 changes: 5 additions & 5 deletions src/Http/Services/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,17 @@ private function getSettingsFile()

if (file_exists($this->filePath)) {
$jsonContents = file_get_contents($this->filePath);
if (!$this->isJson($jsonContents)) {
if (! $this->isJson($jsonContents)) {
$this->setDefaultSettings();
}
} else {
$this->setDefaultSettings();
}

$jsonContents = file_get_contents($this->filePath);
$settings = json_decode($jsonContents, true);
$settings = json_decode(json_encode($settings, JSON_FORCE_OBJECT), false);
$settings = $this->cleanArrays($settings);
$settings = json_decode($jsonContents, true);
$settings = json_decode(json_encode($settings, JSON_FORCE_OBJECT), false);
$settings = $this->cleanArrays($settings);

return $settings;
}
Expand All @@ -170,7 +170,7 @@ private function cleanArrays($settings)
*/
public function setDefaultSettings()
{
$settings = file_get_contents(__DIR__ . '/../../../settings.json');
$settings = file_get_contents(__DIR__.'/../../../settings.json');

return file_put_contents($this->filePath, $settings);
}
Expand Down
14 changes: 7 additions & 7 deletions src/ResourceGeneratorServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Cloudstudio\ResourceGenerator;

use Cloudstudio\ResourceGenerator\Http\Middleware\Authorize;
use Laravel\Nova\Nova;
use Laravel\Nova\Events\ServingNova;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use Laravel\Nova\Events\ServingNova;
use Laravel\Nova\Nova;
use Cloudstudio\ResourceGenerator\Http\Middleware\Authorize;

class ResourceGeneratorServiceProvider extends ServiceProvider
{
Expand All @@ -17,7 +17,7 @@ class ResourceGeneratorServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'resource-generator');
$this->loadViewsFrom(__DIR__.'/../resources/views', 'resource-generator');

$this->app->booted(function () {
$this->routes();
Expand All @@ -38,7 +38,7 @@ protected function routes()

Route::middleware(['nova', Authorize::class])
->prefix('nova-vendor/resource-generator')
->group(__DIR__ . '/../routes/api.php');
->group(__DIR__.'/../routes/api.php');
}

/**
Expand All @@ -59,8 +59,8 @@ public function register()
private function checkSettingsFile()
{
$settingsFile = storage_path('nova-resource-generator.json');
if (!file_exists($settingsFile)) {
$settings = file_get_contents(__DIR__ . '/../settings.json');
if (! file_exists($settingsFile)) {
$settings = file_get_contents(__DIR__.'/../settings.json');

file_put_contents($settingsFile, $settings);
}
Expand Down

0 comments on commit 35b472e

Please sign in to comment.