From 18670086203abdd84b7f7aaf2bb6e4804e4c3ac9 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Thu, 9 Nov 2017 08:49:08 +0800 Subject: [PATCH] Apply fixes from StyleCI (#8) --- config/app.php | 8 ++-- database/factories/ModelFactory.php | 4 +- resources/lang/en/validation.php | 78 +++++++++++++++---------------- resources/lang/id/backup.php | 4 +- resources/lang/id/product.php | 6 +-- resources/lang/id/unit.php | 2 +- resources/lang/id/user.php | 16 +++---- routes/web.php | 6 +-- tests/Feature/Cart/CartControllerTest.php | 4 +- tests/Feature/Cart/SearchProductsTest.php | 6 +-- 10 files changed, 67 insertions(+), 67 deletions(-) diff --git a/config/app.php b/config/app.php index 9796ec9..d14ca91 100644 --- a/config/app.php +++ b/config/app.php @@ -231,10 +231,10 @@ return [ 'Validator' => Illuminate\Support\Facades\Validator::class, 'View' => Illuminate\Support\Facades\View::class, - 'Form' => Collective\Html\FormFacade::class, - 'FormField' => Luthfi\FormField\FormFieldFacade::class, - 'PDF' => Barryvdh\DomPDF\Facade::class, - 'Html' => Collective\Html\HtmlFacade::class, + 'Form' => Collective\Html\FormFacade::class, + 'FormField' => Luthfi\FormField\FormFieldFacade::class, + 'PDF' => Barryvdh\DomPDF\Facade::class, + 'Html' => Collective\Html\HtmlFacade::class, ], ]; diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index f3bace4..cfd7dba 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -13,8 +13,8 @@ $factory->define(App\User::class, function (Faker\Generator $faker) { /* @var \Illuminate\Database\Eloquent\Factory $factory */ $factory->define(App\Product::class, function (Faker\Generator $faker) { return [ - 'name' => $faker->name, - 'unit_id' => function () { + 'name' => $faker->name, + 'unit_id' => function () { return factory(App\Unit::class)->create()->id; }, 'cash_price' => 2000, diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 2a5c743..219d976 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -13,50 +13,50 @@ return [ | */ - 'accepted' => 'The :attribute must be accepted.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', - 'alpha' => 'The :attribute may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'before' => 'The :attribute must be a date before :date.', - 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ + 'accepted' => 'The :attribute must be accepted.', + 'active_url' => 'The :attribute is not a valid URL.', + 'after' => 'The :attribute must be a date after :date.', + 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', + 'alpha' => 'The :attribute may only contain letters.', + 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', + 'alpha_num' => 'The :attribute may only contain letters and numbers.', + 'array' => 'The :attribute must be an array.', + 'before' => 'The :attribute must be a date before :date.', + 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', + 'between' => [ 'numeric' => 'The :attribute must be between :min and :max.', 'file' => 'The :attribute must be between :min and :max kilobytes.', 'string' => 'The :attribute must be between :min and :max characters.', 'array' => 'The :attribute must have between :min and :max items.', ], - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'date' => 'The :attribute is not a valid date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'email' => 'The :attribute must be a valid email address.', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The :attribute field must have a value.', - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'max' => [ + 'boolean' => 'The :attribute field must be true or false.', + 'confirmed' => 'The :attribute confirmation does not match.', + 'date' => 'The :attribute is not a valid date.', + 'date_format' => 'The :attribute does not match the format :format.', + 'different' => 'The :attribute and :other must be different.', + 'digits' => 'The :attribute must be :digits digits.', + 'digits_between' => 'The :attribute must be between :min and :max digits.', + 'dimensions' => 'The :attribute has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'email' => 'The :attribute must be a valid email address.', + 'exists' => 'The selected :attribute is invalid.', + 'file' => 'The :attribute must be a file.', + 'filled' => 'The :attribute field must have a value.', + 'image' => 'The :attribute must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'in_array' => 'The :attribute field does not exist in :other.', + 'integer' => 'The :attribute must be an integer.', + 'ip' => 'The :attribute must be a valid IP address.', + 'json' => 'The :attribute must be a valid JSON string.', + 'max' => [ 'numeric' => 'The :attribute may not be greater than :max.', 'file' => 'The :attribute may not be greater than :max kilobytes.', 'string' => 'The :attribute may not be greater than :max characters.', 'array' => 'The :attribute may not have more than :max items.', ], - 'mimes' => 'The :attribute must be a file of type: :values.', - 'mimetypes' => 'The :attribute must be a file of type: :values.', - 'min' => [ + 'mimes' => 'The :attribute must be a file of type: :values.', + 'mimetypes' => 'The :attribute must be a file of type: :values.', + 'min' => [ 'numeric' => 'The :attribute must be at least :min.', 'file' => 'The :attribute must be at least :min kilobytes.', 'string' => 'The :attribute must be at least :min characters.', @@ -80,11 +80,11 @@ return [ 'string' => 'The :attribute must be :size characters.', 'array' => 'The :attribute must contain :size items.', ], - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid zone.', - 'unique' => 'The :attribute has already been taken.', - 'uploaded' => 'The :attribute failed to upload.', - 'url' => 'The :attribute format is invalid.', + 'string' => 'The :attribute must be a string.', + 'timezone' => 'The :attribute must be a valid zone.', + 'unique' => 'The :attribute has already been taken.', + 'uploaded' => 'The :attribute failed to upload.', + 'url' => 'The :attribute format is invalid.', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/id/backup.php b/resources/lang/id/backup.php index 8cdf6c8..60d0729 100644 --- a/resources/lang/id/backup.php +++ b/resources/lang/id/backup.php @@ -2,8 +2,8 @@ return [ // Labels - 'index_title' => 'Database Backup Manager', - 'list' => 'Backup File List', + 'index_title' => 'Database Backup Manager', + 'list' => 'Backup File List', // Actions 'create' => 'Create Backup File', diff --git a/resources/lang/id/product.php b/resources/lang/id/product.php index b722156..8d58c48 100644 --- a/resources/lang/id/product.php +++ b/resources/lang/id/product.php @@ -31,7 +31,7 @@ return [ 'undeleteable' => 'Data Produk tidak dapat dihapus.', // Attributes - 'name' => 'Nama Produk', - 'cash_price' => 'Harga Tunai', - 'credit_price' => 'Harga Kredit', + 'name' => 'Nama Produk', + 'cash_price' => 'Harga Tunai', + 'credit_price' => 'Harga Kredit', ]; diff --git a/resources/lang/id/unit.php b/resources/lang/id/unit.php index c4ca25c..1396b09 100644 --- a/resources/lang/id/unit.php +++ b/resources/lang/id/unit.php @@ -22,5 +22,5 @@ return [ 'undeleteable' => 'Data Satuan tidak dapat dihapus.', // Attributes - 'name' => 'Nama Satuan', + 'name' => 'Nama Satuan', ]; diff --git a/resources/lang/id/user.php b/resources/lang/id/user.php index 3149b10..e63fabf 100644 --- a/resources/lang/id/user.php +++ b/resources/lang/id/user.php @@ -2,12 +2,12 @@ return [ // Labels - 'uset' => 'User', - 'list' => 'Daftar User', - 'search' => 'Cari User', - 'not_found' => 'User tidak ditemukan', - 'empty' => 'Belum ada User', - 'back_to_index' => 'Kembali ke daftar User', + 'uset' => 'User', + 'list' => 'Daftar User', + 'search' => 'Cari User', + 'not_found' => 'User tidak ditemukan', + 'empty' => 'Belum ada User', + 'back_to_index' => 'Kembali ke daftar User', // Actions 'create' => 'Input User Baru', @@ -23,6 +23,6 @@ return [ 'undeleteable' => 'Data User tidak dapat dihapus.', // Attributes - 'name' => 'Nama User', - 'username' => 'Username', + 'name' => 'Nama User', + 'username' => 'Username', ]; diff --git a/routes/web.php b/routes/web.php index 1d057aa..64545a5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -72,9 +72,9 @@ Route::group(['middleware' => 'auth'], function () { /* * Backup Restore Database Routes */ - Route::post('backups/upload', ['as'=>'backups.upload', 'uses'=>'BackupsController@upload']); - Route::post('backups/{fileName}/restore', ['as'=>'backups.restore', 'uses'=>'BackupsController@restore']); - Route::get('backups/{fileName}/dl', ['as'=>'backups.download', 'uses'=>'BackupsController@download']); + Route::post('backups/upload', ['as' => 'backups.upload', 'uses' => 'BackupsController@upload']); + Route::post('backups/{fileName}/restore', ['as' => 'backups.restore', 'uses' => 'BackupsController@restore']); + Route::get('backups/{fileName}/dl', ['as' => 'backups.download', 'uses' => 'BackupsController@download']); Route::resource('backups', 'BackupsController', ['except' => ['create', 'show', 'edit']]); /* diff --git a/tests/Feature/Cart/CartControllerTest.php b/tests/Feature/Cart/CartControllerTest.php index cd2b959..aed8057 100644 --- a/tests/Feature/Cart/CartControllerTest.php +++ b/tests/Feature/Cart/CartControllerTest.php @@ -21,8 +21,8 @@ class CartControllerTest extends TestCase $cart = new CartCollection(); - $response = $this->post(route('cart.add'), ['create-cash-draft'=> trans('transaction.create_cash')]); - $response = $this->post(route('cart.add'), ['create-credit-draft'=> trans('transaction.create_credit')]); + $response = $this->post(route('cart.add'), ['create-cash-draft' => trans('transaction.create_cash')]); + $response = $this->post(route('cart.add'), ['create-credit-draft' => trans('transaction.create_credit')]); $response->assertSessionHas('transactions.drafts'); $cashDraft = $cart->content()->first(); diff --git a/tests/Feature/Cart/SearchProductsTest.php b/tests/Feature/Cart/SearchProductsTest.php index 5867536..c51e4a4 100644 --- a/tests/Feature/Cart/SearchProductsTest.php +++ b/tests/Feature/Cart/SearchProductsTest.php @@ -28,9 +28,9 @@ class SearchProductsTest extends TestCase $user = $this->loginAsUser(); $response = $this->post(route('api.products.search'), [ - 'query' => 'Bis', - 'draftType'=> $draft->type, - 'draftKey' => $draft->draftKey, + 'query' => 'Bis', + 'draftType' => $draft->type, + 'draftKey' => $draft->draftKey, ]); $response->assertSuccessful();