Skip to content

Commit

Permalink
Merge pull request #11 from Codexshaper/analysis-KZrLr3
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
Codexshaper authored May 21, 2020
2 parents 29f8b00 + 50eef22 commit c31664d
Show file tree
Hide file tree
Showing 21 changed files with 317 additions and 329 deletions.
10 changes: 5 additions & 5 deletions config/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

return [
'base_url' => '',
'prefix' => '/admin',
'namespace' => '\CodexShaper\Menu',
'controller_namespace' => '\CodexShaper\Menu\Http\Controllers',
'resources_path' => 'vendor/codexshaper/laravel-menu-builder/publishable/assets/',
'views' => 'vendor/codexshaper/laravel-menu-builder/publishable/views',
'prefix' => '/admin',
'namespace' => '\CodexShaper\Menu',
'controller_namespace' => '\CodexShaper\Menu\Http\Controllers',
'resources_path' => 'vendor/codexshaper/laravel-menu-builder/publishable/assets/',
'views' => 'vendor/codexshaper/laravel-menu-builder/publishable/views',
// Menu Settings
'depth' => 5,
'apply_child_as_parent' => false,
Expand Down
4 changes: 2 additions & 2 deletions database/migrations/2019_08_22_221932_create_menus_table.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMenusTable extends Migration
{
Expand Down
6 changes: 3 additions & 3 deletions database/seeds/MenuDatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

class MenuDatabaseSeeder extends Seeder
{
protected $seedersPath = __DIR__ . '/../../database/seeds/';
protected $seedersPath = __DIR__.'/../../database/seeds/';

/**
* Seed the application's database.
*
Expand All @@ -18,8 +19,7 @@ public function run()
];

foreach ($seeds as $class) {

$file = $this->seedersPath . $class . '.php';
$file = $this->seedersPath.$class.'.php';
if (file_exists($file) && !class_exists($class)) {
require_once $file;
}
Expand Down
41 changes: 20 additions & 21 deletions database/seeds/MenuItemsSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,30 @@ class MenuItemsSeeder extends Seeder
*/
public function run()
{
if(! $menu = Menu::where('slug', 'admin')->first()) {
$menu = new Menu;
$menu->name = "Admin";
$menu->slug = Str::slug('Admin');
$menu->url = '/admin';
if (!$menu = Menu::where('slug', 'admin')->first()) {
$menu = new Menu();
$menu->name = 'Admin';
$menu->slug = Str::slug('Admin');
$menu->url = '/admin';
$menu->order = 1;
$menu->save();
}
if (! MenuItem::where('slug', Str::slug("Menu Builder"))->first()) {
$menuItem = new MenuItem;
$menuItem->menu_id = $menu->id;
$menuItem->title = "Menu Builder";
$menuItem->slug = Str::slug("Menu Builder");
$menuItem->url = "/admin/menus";
$menuItem->parent_id = null;
$menuItem->order = 1;
$menuItem->route = null;
$menuItem->params = null;
$menuItem->middleware = null;
$menuItem->controller = '\CodexShaper\Menu\Http\Controllers\MenuController@index';
$menuItem->target = '_self';
$menuItem->icon = null;
if (!MenuItem::where('slug', Str::slug('Menu Builder'))->first()) {
$menuItem = new MenuItem();
$menuItem->menu_id = $menu->id;
$menuItem->title = 'Menu Builder';
$menuItem->slug = Str::slug('Menu Builder');
$menuItem->url = '/admin/menus';
$menuItem->parent_id = null;
$menuItem->order = 1;
$menuItem->route = null;
$menuItem->params = null;
$menuItem->middleware = null;
$menuItem->controller = '\CodexShaper\Menu\Http\Controllers\MenuController@index';
$menuItem->target = '_self';
$menuItem->icon = null;
$menuItem->custom_class = null;
$menuItem->save();
}

}
}
}
8 changes: 4 additions & 4 deletions database/seeds/MenuSettingsSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ class MenuSettingsSeeder extends Seeder
*/
public function run()
{
$settings = new MenuSetting;
$settings->menu_id = null;
$settings->depth = 5;
$settings = new MenuSetting();
$settings->menu_id = null;
$settings->depth = 5;
$settings->apply_child_as_parent = 0;
$settings->levels = [
$settings->levels = [
'root' => [
'style' => 'vertical', // horizontal | vertical
],
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/lang/en/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
|
*/

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

];
2 changes: 1 addition & 1 deletion resources/assets/lang/en/pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
*/

'previous' => '&laquo; Previous',
'next' => 'Next &raquo;',
'next' => 'Next &raquo;',

];
8 changes: 4 additions & 4 deletions resources/assets/lang/en/passwords.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
*/

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

];
156 changes: 78 additions & 78 deletions resources/assets/lang/en/validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,109 +13,109 @@
|
*/

'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, dashes and underscores.',
'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.',
'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, dashes and underscores.',
'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' => [
'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.',
'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_equals' => 'The :attribute must be a date equal to :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.',
'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_equals' => 'The :attribute must be a date equal to :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.',
'ends_with' => 'The :attribute must end with one of the following: :values',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'gt' => [
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'email' => 'The :attribute must be a valid email address.',
'ends_with' => 'The :attribute must end with one of the following: :values',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'gt' => [
'numeric' => 'The :attribute must be greater than :value.',
'file' => 'The :attribute must be greater than :value kilobytes.',
'string' => 'The :attribute must be greater than :value characters.',
'array' => 'The :attribute must have more than :value items.',
'file' => 'The :attribute must be greater than :value kilobytes.',
'string' => 'The :attribute must be greater than :value characters.',
'array' => 'The :attribute must have more than :value items.',
],
'gte' => [
'numeric' => 'The :attribute must be greater than or equal :value.',
'file' => 'The :attribute must be greater than or equal :value kilobytes.',
'string' => 'The :attribute must be greater than or equal :value characters.',
'array' => 'The :attribute must have :value items or more.',
'file' => 'The :attribute must be greater than or equal :value kilobytes.',
'string' => 'The :attribute must be greater than or equal :value characters.',
'array' => 'The :attribute must have :value items or more.',
],
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'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.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'lt' => [
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'lt' => [
'numeric' => 'The :attribute must be less than :value.',
'file' => 'The :attribute must be less than :value kilobytes.',
'string' => 'The :attribute must be less than :value characters.',
'array' => 'The :attribute must have less than :value items.',
'file' => 'The :attribute must be less than :value kilobytes.',
'string' => 'The :attribute must be less than :value characters.',
'array' => 'The :attribute must have less than :value items.',
],
'lte' => [
'numeric' => 'The :attribute must be less than or equal :value.',
'file' => 'The :attribute must be less than or equal :value kilobytes.',
'string' => 'The :attribute must be less than or equal :value characters.',
'array' => 'The :attribute must not have more than :value items.',
'file' => 'The :attribute must be less than or equal :value kilobytes.',
'string' => 'The :attribute must be less than or equal :value characters.',
'array' => 'The :attribute must not have more than :value items.',
],
'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.',
'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.',
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'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.',
'array' => 'The :attribute must have at least :min items.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
],
'not_in' => 'The selected :attribute is invalid.',
'not_regex' => 'The :attribute format is invalid.',
'numeric' => 'The :attribute must be a number.',
'present' => 'The :attribute field must be present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values are present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'not_in' => 'The selected :attribute is invalid.',
'not_regex' => 'The :attribute format is invalid.',
'numeric' => 'The :attribute must be a number.',
'present' => 'The :attribute field must be present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values are present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' => [
'same' => 'The :attribute and :other must match.',
'size' => [
'numeric' => 'The :attribute must be :size.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
],
'starts_with' => 'The :attribute must start with one of the following: :values',
'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.',
'uuid' => 'The :attribute must be a valid UUID.',
'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.',
'uuid' => 'The :attribute must be a valid UUID.',

/*
|--------------------------------------------------------------------------
Expand Down
22 changes: 10 additions & 12 deletions routes/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use CodexShaper\Menu\Models\MenuItem;

Route::group([
'prefix' => config('menu.prefix'),
'namespace' => config('menu.controller_namespace')
'prefix' => config('menu.prefix'),
'namespace' => config('menu.controller_namespace'),
], function () {
Route::get('menus', 'MenuController@index');
Route::get('menu/builder/{id}', 'MenuItemController@showMenuItems')->name('menu.builder');
Expand Down Expand Up @@ -40,23 +40,21 @@
$menuItems = MenuItem::all();

foreach ($menuItems as $menuItem) {

if($menuItem->url != null) {

if ($menuItem->url != null) {
$controller = $menuItem->controller ?? '\CodexShaper\Menu\Http\Controllers\MenuItemController@setRoute';

if (! class_exists($controller)) {
if (!class_exists($controller)) {
$controller = '\CodexShaper\Menu\Http\Controllers\MenuItemController@setRoute';
}
if($menuItem->route && !$menuItem->middleware) {

if ($menuItem->route && !$menuItem->middleware) {
Route::get($menuItem->url, $controller)->name($menuItem->route);
}else if($menuItem->middleware && !$menuItem->route){
} elseif ($menuItem->middleware && !$menuItem->route) {
Route::get($menuItem->url, $controller)->middleware($menuItem->middleware);
}else if($menuItem->route && $menuItem->middleware) {
} elseif ($menuItem->route && $menuItem->middleware) {
Route::get($menuItem->url, $controller)->name($menuItem->route)->middleware(explode(',', $menuItem->middleware));
}else if(!$menuItem->route && !$menuItem->middleware) {
} elseif (!$menuItem->route && !$menuItem->middleware) {
Route::get($menuItem->url, $controller);
}
}
}
}
Loading

0 comments on commit c31664d

Please sign in to comment.