Skip to content

Commit c31664d

Browse files
authored
Merge pull request #11 from Codexshaper/analysis-KZrLr3
Apply fixes from StyleCI
2 parents 29f8b00 + 50eef22 commit c31664d

21 files changed

+317
-329
lines changed

config/menu.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
return [
44
'base_url' => '',
5-
'prefix' => '/admin',
6-
'namespace' => '\CodexShaper\Menu',
7-
'controller_namespace' => '\CodexShaper\Menu\Http\Controllers',
8-
'resources_path' => 'vendor/codexshaper/laravel-menu-builder/publishable/assets/',
9-
'views' => 'vendor/codexshaper/laravel-menu-builder/publishable/views',
5+
'prefix' => '/admin',
6+
'namespace' => '\CodexShaper\Menu',
7+
'controller_namespace' => '\CodexShaper\Menu\Http\Controllers',
8+
'resources_path' => 'vendor/codexshaper/laravel-menu-builder/publishable/assets/',
9+
'views' => 'vendor/codexshaper/laravel-menu-builder/publishable/views',
1010
// Menu Settings
1111
'depth' => 5,
1212
'apply_child_as_parent' => false,

database/migrations/2019_08_22_221932_create_menus_table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

3-
use Illuminate\Support\Facades\Schema;
4-
use Illuminate\Database\Schema\Blueprint;
53
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
66

77
class CreateMenusTable extends Migration
88
{

database/seeds/MenuDatabaseSeeder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
class MenuDatabaseSeeder extends Seeder
66
{
7-
protected $seedersPath = __DIR__ . '/../../database/seeds/';
7+
protected $seedersPath = __DIR__.'/../../database/seeds/';
8+
89
/**
910
* Seed the application's database.
1011
*
@@ -18,8 +19,7 @@ public function run()
1819
];
1920

2021
foreach ($seeds as $class) {
21-
22-
$file = $this->seedersPath . $class . '.php';
22+
$file = $this->seedersPath.$class.'.php';
2323
if (file_exists($file) && !class_exists($class)) {
2424
require_once $file;
2525
}

database/seeds/MenuItemsSeeder.php

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,30 @@ class MenuItemsSeeder extends Seeder
1414
*/
1515
public function run()
1616
{
17-
if(! $menu = Menu::where('slug', 'admin')->first()) {
18-
$menu = new Menu;
19-
$menu->name = "Admin";
20-
$menu->slug = Str::slug('Admin');
21-
$menu->url = '/admin';
17+
if (!$menu = Menu::where('slug', 'admin')->first()) {
18+
$menu = new Menu();
19+
$menu->name = 'Admin';
20+
$menu->slug = Str::slug('Admin');
21+
$menu->url = '/admin';
2222
$menu->order = 1;
2323
$menu->save();
2424
}
25-
if (! MenuItem::where('slug', Str::slug("Menu Builder"))->first()) {
26-
$menuItem = new MenuItem;
27-
$menuItem->menu_id = $menu->id;
28-
$menuItem->title = "Menu Builder";
29-
$menuItem->slug = Str::slug("Menu Builder");
30-
$menuItem->url = "/admin/menus";
31-
$menuItem->parent_id = null;
32-
$menuItem->order = 1;
33-
$menuItem->route = null;
34-
$menuItem->params = null;
35-
$menuItem->middleware = null;
36-
$menuItem->controller = '\CodexShaper\Menu\Http\Controllers\MenuController@index';
37-
$menuItem->target = '_self';
38-
$menuItem->icon = null;
25+
if (!MenuItem::where('slug', Str::slug('Menu Builder'))->first()) {
26+
$menuItem = new MenuItem();
27+
$menuItem->menu_id = $menu->id;
28+
$menuItem->title = 'Menu Builder';
29+
$menuItem->slug = Str::slug('Menu Builder');
30+
$menuItem->url = '/admin/menus';
31+
$menuItem->parent_id = null;
32+
$menuItem->order = 1;
33+
$menuItem->route = null;
34+
$menuItem->params = null;
35+
$menuItem->middleware = null;
36+
$menuItem->controller = '\CodexShaper\Menu\Http\Controllers\MenuController@index';
37+
$menuItem->target = '_self';
38+
$menuItem->icon = null;
3939
$menuItem->custom_class = null;
4040
$menuItem->save();
4141
}
42-
4342
}
44-
}
43+
}

database/seeds/MenuSettingsSeeder.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ class MenuSettingsSeeder extends Seeder
1212
*/
1313
public function run()
1414
{
15-
$settings = new MenuSetting;
16-
$settings->menu_id = null;
17-
$settings->depth = 5;
15+
$settings = new MenuSetting();
16+
$settings->menu_id = null;
17+
$settings->depth = 5;
1818
$settings->apply_child_as_parent = 0;
19-
$settings->levels = [
19+
$settings->levels = [
2020
'root' => [
2121
'style' => 'vertical', // horizontal | vertical
2222
],

resources/assets/lang/en/auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
|
1414
*/
1515

16-
'failed' => 'These credentials do not match our records.',
16+
'failed' => 'These credentials do not match our records.',
1717
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
1818

1919
];

resources/assets/lang/en/pagination.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
*/
1515

1616
'previous' => '&laquo; Previous',
17-
'next' => 'Next &raquo;',
17+
'next' => 'Next &raquo;',
1818

1919
];

resources/assets/lang/en/passwords.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
*/
1515

1616
'password' => 'Passwords must be at least eight characters and match the confirmation.',
17-
'reset' => 'Your password has been reset!',
18-
'sent' => 'We have e-mailed your password reset link!',
19-
'token' => 'This password reset token is invalid.',
20-
'user' => "We can't find a user with that e-mail address.",
17+
'reset' => 'Your password has been reset!',
18+
'sent' => 'We have e-mailed your password reset link!',
19+
'token' => 'This password reset token is invalid.',
20+
'user' => "We can't find a user with that e-mail address.",
2121

2222
];

resources/assets/lang/en/validation.php

Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -13,109 +13,109 @@
1313
|
1414
*/
1515

16-
'accepted' => 'The :attribute must be accepted.',
17-
'active_url' => 'The :attribute is not a valid URL.',
18-
'after' => 'The :attribute must be a date after :date.',
19-
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
20-
'alpha' => 'The :attribute may only contain letters.',
21-
'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.',
22-
'alpha_num' => 'The :attribute may only contain letters and numbers.',
23-
'array' => 'The :attribute must be an array.',
24-
'before' => 'The :attribute must be a date before :date.',
16+
'accepted' => 'The :attribute must be accepted.',
17+
'active_url' => 'The :attribute is not a valid URL.',
18+
'after' => 'The :attribute must be a date after :date.',
19+
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
20+
'alpha' => 'The :attribute may only contain letters.',
21+
'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.',
22+
'alpha_num' => 'The :attribute may only contain letters and numbers.',
23+
'array' => 'The :attribute must be an array.',
24+
'before' => 'The :attribute must be a date before :date.',
2525
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
26-
'between' => [
26+
'between' => [
2727
'numeric' => 'The :attribute must be between :min and :max.',
28-
'file' => 'The :attribute must be between :min and :max kilobytes.',
29-
'string' => 'The :attribute must be between :min and :max characters.',
30-
'array' => 'The :attribute must have between :min and :max items.',
28+
'file' => 'The :attribute must be between :min and :max kilobytes.',
29+
'string' => 'The :attribute must be between :min and :max characters.',
30+
'array' => 'The :attribute must have between :min and :max items.',
3131
],
32-
'boolean' => 'The :attribute field must be true or false.',
33-
'confirmed' => 'The :attribute confirmation does not match.',
34-
'date' => 'The :attribute is not a valid date.',
35-
'date_equals' => 'The :attribute must be a date equal to :date.',
36-
'date_format' => 'The :attribute does not match the format :format.',
37-
'different' => 'The :attribute and :other must be different.',
38-
'digits' => 'The :attribute must be :digits digits.',
32+
'boolean' => 'The :attribute field must be true or false.',
33+
'confirmed' => 'The :attribute confirmation does not match.',
34+
'date' => 'The :attribute is not a valid date.',
35+
'date_equals' => 'The :attribute must be a date equal to :date.',
36+
'date_format' => 'The :attribute does not match the format :format.',
37+
'different' => 'The :attribute and :other must be different.',
38+
'digits' => 'The :attribute must be :digits digits.',
3939
'digits_between' => 'The :attribute must be between :min and :max digits.',
40-
'dimensions' => 'The :attribute has invalid image dimensions.',
41-
'distinct' => 'The :attribute field has a duplicate value.',
42-
'email' => 'The :attribute must be a valid email address.',
43-
'ends_with' => 'The :attribute must end with one of the following: :values',
44-
'exists' => 'The selected :attribute is invalid.',
45-
'file' => 'The :attribute must be a file.',
46-
'filled' => 'The :attribute field must have a value.',
47-
'gt' => [
40+
'dimensions' => 'The :attribute has invalid image dimensions.',
41+
'distinct' => 'The :attribute field has a duplicate value.',
42+
'email' => 'The :attribute must be a valid email address.',
43+
'ends_with' => 'The :attribute must end with one of the following: :values',
44+
'exists' => 'The selected :attribute is invalid.',
45+
'file' => 'The :attribute must be a file.',
46+
'filled' => 'The :attribute field must have a value.',
47+
'gt' => [
4848
'numeric' => 'The :attribute must be greater than :value.',
49-
'file' => 'The :attribute must be greater than :value kilobytes.',
50-
'string' => 'The :attribute must be greater than :value characters.',
51-
'array' => 'The :attribute must have more than :value items.',
49+
'file' => 'The :attribute must be greater than :value kilobytes.',
50+
'string' => 'The :attribute must be greater than :value characters.',
51+
'array' => 'The :attribute must have more than :value items.',
5252
],
5353
'gte' => [
5454
'numeric' => 'The :attribute must be greater than or equal :value.',
55-
'file' => 'The :attribute must be greater than or equal :value kilobytes.',
56-
'string' => 'The :attribute must be greater than or equal :value characters.',
57-
'array' => 'The :attribute must have :value items or more.',
55+
'file' => 'The :attribute must be greater than or equal :value kilobytes.',
56+
'string' => 'The :attribute must be greater than or equal :value characters.',
57+
'array' => 'The :attribute must have :value items or more.',
5858
],
59-
'image' => 'The :attribute must be an image.',
60-
'in' => 'The selected :attribute is invalid.',
59+
'image' => 'The :attribute must be an image.',
60+
'in' => 'The selected :attribute is invalid.',
6161
'in_array' => 'The :attribute field does not exist in :other.',
62-
'integer' => 'The :attribute must be an integer.',
63-
'ip' => 'The :attribute must be a valid IP address.',
64-
'ipv4' => 'The :attribute must be a valid IPv4 address.',
65-
'ipv6' => 'The :attribute must be a valid IPv6 address.',
66-
'json' => 'The :attribute must be a valid JSON string.',
67-
'lt' => [
62+
'integer' => 'The :attribute must be an integer.',
63+
'ip' => 'The :attribute must be a valid IP address.',
64+
'ipv4' => 'The :attribute must be a valid IPv4 address.',
65+
'ipv6' => 'The :attribute must be a valid IPv6 address.',
66+
'json' => 'The :attribute must be a valid JSON string.',
67+
'lt' => [
6868
'numeric' => 'The :attribute must be less than :value.',
69-
'file' => 'The :attribute must be less than :value kilobytes.',
70-
'string' => 'The :attribute must be less than :value characters.',
71-
'array' => 'The :attribute must have less than :value items.',
69+
'file' => 'The :attribute must be less than :value kilobytes.',
70+
'string' => 'The :attribute must be less than :value characters.',
71+
'array' => 'The :attribute must have less than :value items.',
7272
],
7373
'lte' => [
7474
'numeric' => 'The :attribute must be less than or equal :value.',
75-
'file' => 'The :attribute must be less than or equal :value kilobytes.',
76-
'string' => 'The :attribute must be less than or equal :value characters.',
77-
'array' => 'The :attribute must not have more than :value items.',
75+
'file' => 'The :attribute must be less than or equal :value kilobytes.',
76+
'string' => 'The :attribute must be less than or equal :value characters.',
77+
'array' => 'The :attribute must not have more than :value items.',
7878
],
7979
'max' => [
8080
'numeric' => 'The :attribute may not be greater than :max.',
81-
'file' => 'The :attribute may not be greater than :max kilobytes.',
82-
'string' => 'The :attribute may not be greater than :max characters.',
83-
'array' => 'The :attribute may not have more than :max items.',
81+
'file' => 'The :attribute may not be greater than :max kilobytes.',
82+
'string' => 'The :attribute may not be greater than :max characters.',
83+
'array' => 'The :attribute may not have more than :max items.',
8484
],
85-
'mimes' => 'The :attribute must be a file of type: :values.',
85+
'mimes' => 'The :attribute must be a file of type: :values.',
8686
'mimetypes' => 'The :attribute must be a file of type: :values.',
87-
'min' => [
87+
'min' => [
8888
'numeric' => 'The :attribute must be at least :min.',
89-
'file' => 'The :attribute must be at least :min kilobytes.',
90-
'string' => 'The :attribute must be at least :min characters.',
91-
'array' => 'The :attribute must have at least :min items.',
89+
'file' => 'The :attribute must be at least :min kilobytes.',
90+
'string' => 'The :attribute must be at least :min characters.',
91+
'array' => 'The :attribute must have at least :min items.',
9292
],
93-
'not_in' => 'The selected :attribute is invalid.',
94-
'not_regex' => 'The :attribute format is invalid.',
95-
'numeric' => 'The :attribute must be a number.',
96-
'present' => 'The :attribute field must be present.',
97-
'regex' => 'The :attribute format is invalid.',
98-
'required' => 'The :attribute field is required.',
99-
'required_if' => 'The :attribute field is required when :other is :value.',
100-
'required_unless' => 'The :attribute field is required unless :other is in :values.',
101-
'required_with' => 'The :attribute field is required when :values is present.',
102-
'required_with_all' => 'The :attribute field is required when :values are present.',
103-
'required_without' => 'The :attribute field is required when :values is not present.',
93+
'not_in' => 'The selected :attribute is invalid.',
94+
'not_regex' => 'The :attribute format is invalid.',
95+
'numeric' => 'The :attribute must be a number.',
96+
'present' => 'The :attribute field must be present.',
97+
'regex' => 'The :attribute format is invalid.',
98+
'required' => 'The :attribute field is required.',
99+
'required_if' => 'The :attribute field is required when :other is :value.',
100+
'required_unless' => 'The :attribute field is required unless :other is in :values.',
101+
'required_with' => 'The :attribute field is required when :values is present.',
102+
'required_with_all' => 'The :attribute field is required when :values are present.',
103+
'required_without' => 'The :attribute field is required when :values is not present.',
104104
'required_without_all' => 'The :attribute field is required when none of :values are present.',
105-
'same' => 'The :attribute and :other must match.',
106-
'size' => [
105+
'same' => 'The :attribute and :other must match.',
106+
'size' => [
107107
'numeric' => 'The :attribute must be :size.',
108-
'file' => 'The :attribute must be :size kilobytes.',
109-
'string' => 'The :attribute must be :size characters.',
110-
'array' => 'The :attribute must contain :size items.',
108+
'file' => 'The :attribute must be :size kilobytes.',
109+
'string' => 'The :attribute must be :size characters.',
110+
'array' => 'The :attribute must contain :size items.',
111111
],
112112
'starts_with' => 'The :attribute must start with one of the following: :values',
113-
'string' => 'The :attribute must be a string.',
114-
'timezone' => 'The :attribute must be a valid zone.',
115-
'unique' => 'The :attribute has already been taken.',
116-
'uploaded' => 'The :attribute failed to upload.',
117-
'url' => 'The :attribute format is invalid.',
118-
'uuid' => 'The :attribute must be a valid UUID.',
113+
'string' => 'The :attribute must be a string.',
114+
'timezone' => 'The :attribute must be a valid zone.',
115+
'unique' => 'The :attribute has already been taken.',
116+
'uploaded' => 'The :attribute failed to upload.',
117+
'url' => 'The :attribute format is invalid.',
118+
'uuid' => 'The :attribute must be a valid UUID.',
119119

120120
/*
121121
|--------------------------------------------------------------------------

routes/menu.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use CodexShaper\Menu\Models\MenuItem;
44

55
Route::group([
6-
'prefix' => config('menu.prefix'),
7-
'namespace' => config('menu.controller_namespace')
6+
'prefix' => config('menu.prefix'),
7+
'namespace' => config('menu.controller_namespace'),
88
], function () {
99
Route::get('menus', 'MenuController@index');
1010
Route::get('menu/builder/{id}', 'MenuItemController@showMenuItems')->name('menu.builder');
@@ -40,23 +40,21 @@
4040
$menuItems = MenuItem::all();
4141

4242
foreach ($menuItems as $menuItem) {
43-
44-
if($menuItem->url != null) {
45-
43+
if ($menuItem->url != null) {
4644
$controller = $menuItem->controller ?? '\CodexShaper\Menu\Http\Controllers\MenuItemController@setRoute';
4745

48-
if (! class_exists($controller)) {
46+
if (!class_exists($controller)) {
4947
$controller = '\CodexShaper\Menu\Http\Controllers\MenuItemController@setRoute';
5048
}
51-
52-
if($menuItem->route && !$menuItem->middleware) {
49+
50+
if ($menuItem->route && !$menuItem->middleware) {
5351
Route::get($menuItem->url, $controller)->name($menuItem->route);
54-
}else if($menuItem->middleware && !$menuItem->route){
52+
} elseif ($menuItem->middleware && !$menuItem->route) {
5553
Route::get($menuItem->url, $controller)->middleware($menuItem->middleware);
56-
}else if($menuItem->route && $menuItem->middleware) {
54+
} elseif ($menuItem->route && $menuItem->middleware) {
5755
Route::get($menuItem->url, $controller)->name($menuItem->route)->middleware(explode(',', $menuItem->middleware));
58-
}else if(!$menuItem->route && !$menuItem->middleware) {
56+
} elseif (!$menuItem->route && !$menuItem->middleware) {
5957
Route::get($menuItem->url, $controller);
6058
}
6159
}
62-
}
60+
}

0 commit comments

Comments
 (0)