@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('admins', function (Blueprint $table) { |
|
| 16 | + Schema::create('admins', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->string('name'); |
| 19 | 19 | $table->string('email')->unique(); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('admin_panel_navigation', function (Blueprint $table) { |
|
| 16 | + Schema::create('admin_panel_navigation', function(Blueprint $table) { |
|
| 17 | 17 | // These columns are needed for Baum's Nested Set implementation to work. |
| 18 | 18 | // Column names may be changed, but they *must* all exist and be modified |
| 19 | 19 | // in the model. |
@@ -16,21 +16,21 @@ discard block |
||
| 16 | 16 | $tableNames = config('permission.table_names'); |
| 17 | 17 | $columnNames = config('permission.column_names'); |
| 18 | 18 | |
| 19 | - Schema::create($tableNames['permissions'], function (Blueprint $table) { |
|
| 19 | + Schema::create($tableNames['permissions'], function(Blueprint $table) { |
|
| 20 | 20 | $table->increments('id'); |
| 21 | 21 | $table->string('name'); |
| 22 | 22 | $table->string('guard_name'); |
| 23 | 23 | $table->timestamps(); |
| 24 | 24 | }); |
| 25 | 25 | |
| 26 | - Schema::create($tableNames['roles'], function (Blueprint $table) { |
|
| 26 | + Schema::create($tableNames['roles'], function(Blueprint $table) { |
|
| 27 | 27 | $table->increments('id'); |
| 28 | 28 | $table->string('name'); |
| 29 | 29 | $table->string('guard_name'); |
| 30 | 30 | $table->timestamps(); |
| 31 | 31 | }); |
| 32 | 32 | |
| 33 | - Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
| 33 | + Schema::create($tableNames['model_has_permissions'], function(Blueprint $table) use ($tableNames, $columnNames) { |
|
| 34 | 34 | $table->unsignedInteger('permission_id'); |
| 35 | 35 | |
| 36 | 36 | $table->string('model_type'); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | 'model_has_permissions_permission_model_type_primary'); |
| 47 | 47 | }); |
| 48 | 48 | |
| 49 | - Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
| 49 | + Schema::create($tableNames['model_has_roles'], function(Blueprint $table) use ($tableNames, $columnNames) { |
|
| 50 | 50 | $table->unsignedInteger('role_id'); |
| 51 | 51 | |
| 52 | 52 | $table->string('model_type'); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | 'model_has_roles_role_model_type_primary'); |
| 63 | 63 | }); |
| 64 | 64 | |
| 65 | - Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { |
|
| 65 | + Schema::create($tableNames['role_has_permissions'], function(Blueprint $table) use ($tableNames) { |
|
| 66 | 66 | $table->unsignedInteger('permission_id'); |
| 67 | 67 | $table->unsignedInteger('role_id'); |
| 68 | 68 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | class URLify |
| 55 | 55 | { |
| 56 | 56 | public static $maps = [ |
| 57 | - 'de' => [ /* German */ |
|
| 57 | + 'de' => [/* German */ |
|
| 58 | 58 | 'Ä' => 'Ae', |
| 59 | 59 | 'Ö' => 'Oe', |
| 60 | 60 | 'Ü' => 'Ue', |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | 'latin_symbols' => [ |
| 144 | 144 | '©' => '(c)', |
| 145 | 145 | ], |
| 146 | - 'el' => [ /* Greek */ |
|
| 146 | + 'el' => [/* Greek */ |
|
| 147 | 147 | 'α' => 'a', |
| 148 | 148 | 'β' => 'b', |
| 149 | 149 | 'γ' => 'g', |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | 'Ϊ' => 'I', |
| 215 | 215 | 'Ϋ' => 'Y', |
| 216 | 216 | ], |
| 217 | - 'tr' => [ /* Turkish */ |
|
| 217 | + 'tr' => [/* Turkish */ |
|
| 218 | 218 | 'ş' => 's', |
| 219 | 219 | 'Ş' => 'S', |
| 220 | 220 | 'ı' => 'i', |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | 'ğ' => 'g', |
| 229 | 229 | 'Ğ' => 'G', |
| 230 | 230 | ], |
| 231 | - 'bg' => [ /* Bulgarian */ |
|
| 231 | + 'bg' => [/* Bulgarian */ |
|
| 232 | 232 | 'Щ' => 'Sht', |
| 233 | 233 | 'Ш' => 'Sh', |
| 234 | 234 | 'Ч' => 'Ch', |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | 'ь' => '', |
| 291 | 291 | 'ъ' => 'a', |
| 292 | 292 | ], |
| 293 | - 'ru' => [ /* Russian */ |
|
| 293 | + 'ru' => [/* Russian */ |
|
| 294 | 294 | 'а' => 'a', |
| 295 | 295 | 'б' => 'b', |
| 296 | 296 | 'в' => 'v', |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | 'Я' => 'Ya', |
| 360 | 360 | '№' => '', |
| 361 | 361 | ], |
| 362 | - 'uk' => [ /* Ukrainian */ |
|
| 362 | + 'uk' => [/* Ukrainian */ |
|
| 363 | 363 | 'Є' => 'Ye', |
| 364 | 364 | 'І' => 'I', |
| 365 | 365 | 'Ї' => 'Yi', |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | 'ї' => 'yi', |
| 370 | 370 | 'ґ' => 'g', |
| 371 | 371 | ], |
| 372 | - 'kk' => [ /* Kazakh */ |
|
| 372 | + 'kk' => [/* Kazakh */ |
|
| 373 | 373 | 'Ә' => 'A', |
| 374 | 374 | 'Ғ' => 'G', |
| 375 | 375 | 'Қ' => 'Q', |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | 'ү' => 'u', |
| 388 | 388 | 'һ' => 'h', |
| 389 | 389 | ], |
| 390 | - 'cs' => [ /* Czech */ |
|
| 390 | + 'cs' => [/* Czech */ |
|
| 391 | 391 | 'č' => 'c', |
| 392 | 392 | 'ď' => 'd', |
| 393 | 393 | 'ě' => 'e', |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | 'Ů' => 'U', |
| 408 | 408 | 'Ž' => 'Z', |
| 409 | 409 | ], |
| 410 | - 'pl' => [ /* Polish */ |
|
| 410 | + 'pl' => [/* Polish */ |
|
| 411 | 411 | 'ą' => 'a', |
| 412 | 412 | 'ć' => 'c', |
| 413 | 413 | 'ę' => 'e', |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | 'Ź' => 'Z', |
| 428 | 428 | 'Ż' => 'Z', |
| 429 | 429 | ], |
| 430 | - 'ro' => [ /* Romanian */ |
|
| 430 | + 'ro' => [/* Romanian */ |
|
| 431 | 431 | 'ă' => 'a', |
| 432 | 432 | 'â' => 'a', |
| 433 | 433 | 'î' => 'i', |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | 'Ţ' => 'T', |
| 437 | 437 | 'ţ' => 't', |
| 438 | 438 | ], |
| 439 | - 'lv' => [ /* Latvian */ |
|
| 439 | + 'lv' => [/* Latvian */ |
|
| 440 | 440 | 'ā' => 'a', |
| 441 | 441 | 'č' => 'c', |
| 442 | 442 | 'ē' => 'e', |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | 'Ū' => 'u', |
| 461 | 461 | 'Ž' => 'Z', |
| 462 | 462 | ], |
| 463 | - 'lt' => [ /* Lithuanian */ |
|
| 463 | + 'lt' => [/* Lithuanian */ |
|
| 464 | 464 | 'ą' => 'a', |
| 465 | 465 | 'č' => 'c', |
| 466 | 466 | 'ę' => 'e', |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | 'Ū' => 'U', |
| 481 | 481 | 'Ž' => 'Z', |
| 482 | 482 | ], |
| 483 | - 'vi' => [ /* Vietnamese */ |
|
| 483 | + 'vi' => [/* Vietnamese */ |
|
| 484 | 484 | 'Á' => 'A', |
| 485 | 485 | 'À' => 'A', |
| 486 | 486 | 'Ả' => 'A', |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | 'Đ' => 'D', |
| 617 | 617 | 'đ' => 'd', |
| 618 | 618 | ], |
| 619 | - 'ar' => [ /* Arabic */ |
|
| 619 | + 'ar' => [/* Arabic */ |
|
| 620 | 620 | 'أ' => 'a', |
| 621 | 621 | 'ب' => 'b', |
| 622 | 622 | 'ت' => 't', |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | '٨' => '8', |
| 663 | 663 | '٩' => '9', |
| 664 | 664 | ], |
| 665 | - 'fa' => [ /* Persian */ |
|
| 665 | + 'fa' => [/* Persian */ |
|
| 666 | 666 | 'گ' => 'g', |
| 667 | 667 | 'ژ' => 'j', |
| 668 | 668 | 'پ' => 'p', |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | '۸' => '8', |
| 681 | 681 | '۹' => '9', |
| 682 | 682 | ], |
| 683 | - 'sr' => [ /* Serbian */ |
|
| 683 | + 'sr' => [/* Serbian */ |
|
| 684 | 684 | 'ђ' => 'dj', |
| 685 | 685 | 'ј' => 'j', |
| 686 | 686 | 'љ' => 'lj', |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | 'Џ' => 'Dz', |
| 697 | 697 | 'Đ' => 'Dj', |
| 698 | 698 | ], |
| 699 | - 'az' => [ /* Azerbaijani */ |
|
| 699 | + 'az' => [/* Azerbaijani */ |
|
| 700 | 700 | 'ç' => 'c', |
| 701 | 701 | 'ə' => 'e', |
| 702 | 702 | 'ğ' => 'g', |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | 'Ş' => 'S', |
| 713 | 713 | 'Ü' => 'U', |
| 714 | 714 | ], |
| 715 | - 'sk' => [ /* Slovak */ |
|
| 715 | + 'sk' => [/* Slovak */ |
|
| 716 | 716 | 'ĺ' => 'l', |
| 717 | 717 | 'ľ' => 'l', |
| 718 | 718 | 'ŕ' => 'r', |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | } |
| 890 | 890 | } |
| 891 | 891 | |
| 892 | - self::$regex = '/[' . preg_quote(self::$chars, '/') . ']/u'; |
|
| 892 | + self::$regex = '/['.preg_quote(self::$chars, '/').']/u'; |
|
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | /** |
@@ -964,22 +964,22 @@ discard block |
||
| 964 | 964 | |
| 965 | 965 | if ($use_remove_list) { |
| 966 | 966 | // remove all these words from the string before urlifying |
| 967 | - $text = preg_replace('/\b(' . join('|', self::$remove_list) . ')\b/i', '', $text); |
|
| 967 | + $text = preg_replace('/\b('.join('|', self::$remove_list).')\b/i', '', $text); |
|
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | // if downcode doesn't hit, the char will be stripped here |
| 971 | 971 | $remove_pattern = ($file_name) ? '/[^_\-.\-a-zA-Z0-9\s]/u' : '/[^\s_\-a-zA-Z0-9]/u'; |
| 972 | 972 | $text = preg_replace($remove_pattern, '', $text); // remove unneeded chars |
| 973 | 973 | if ($treat_underscore_as_space) { |
| 974 | - $text = str_replace('_', ' ', $text); // treat underscores as spaces |
|
| 974 | + $text = str_replace('_', ' ', $text); // treat underscores as spaces |
|
| 975 | 975 | } |
| 976 | - $text = preg_replace('/^\s+|\s+$/u', '', $text); // trim leading/trailing spaces |
|
| 977 | - $text = preg_replace('/[-\s]+/u', '-', $text); // convert spaces to hyphens |
|
| 976 | + $text = preg_replace('/^\s+|\s+$/u', '', $text); // trim leading/trailing spaces |
|
| 977 | + $text = preg_replace('/[-\s]+/u', '-', $text); // convert spaces to hyphens |
|
| 978 | 978 | if ($lower_case) { |
| 979 | - $text = strtolower($text); // convert to lowercase |
|
| 979 | + $text = strtolower($text); // convert to lowercase |
|
| 980 | 980 | } |
| 981 | 981 | |
| 982 | - return trim(substr($text, 0, $length), '-'); // trim to first $length chars |
|
| 982 | + return trim(substr($text, 0, $length), '-'); // trim to first $length chars |
|
| 983 | 983 | } |
| 984 | 984 | |
| 985 | 985 | /** |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function handle() |
| 32 | 32 | { |
| 33 | - $className = (string) $this->argument('class'); |
|
| 33 | + $className = (string)$this->argument('class'); |
|
| 34 | 34 | |
| 35 | - $packagePath = __DIR__ .'/../../../../'; |
|
| 36 | - $stub = file_get_contents($packagePath .'stubs/tool.stub'); |
|
| 35 | + $packagePath = __DIR__.'/../../../../'; |
|
| 36 | + $stub = file_get_contents($packagePath.'stubs/tool.stub'); |
|
| 37 | 37 | |
| 38 | 38 | $position = $this->choice('Tool position?', [ |
| 39 | 39 | ToolInterface::POSITION_HEADER, |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | ToolInterface::POSITION_BODY_BOTTOM, |
| 42 | 42 | ToolInterface::POSITION_BODY_BOTH, |
| 43 | 43 | ]); |
| 44 | - $position = strtoupper('position_'. $position); |
|
| 44 | + $position = strtoupper('position_'.$position); |
|
| 45 | 45 | $ident = Str::random(); |
| 46 | 46 | $view = Str::snake($className); |
| 47 | 47 | |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | $filepath = app_path(sprintf('Jarboe/Toolbar/%s.php', $className)); |
| 50 | 50 | |
| 51 | 51 | if (!File::exists(app_path('Jarboe/Toolbar'))) { |
| 52 | - File::makeDirectory(app_path('Jarboe/Toolbar'),0775,true,false); |
|
| 52 | + File::makeDirectory(app_path('Jarboe/Toolbar'), 0775, true, false); |
|
| 53 | 53 | } |
| 54 | 54 | File::put($filepath, $tool); |
| 55 | 55 | |
| 56 | - $this->info('Created: '. $filepath); |
|
| 56 | + $this->info('Created: '.$filepath); |
|
| 57 | 57 | } |
| 58 | 58 | } |
@@ -69,17 +69,17 @@ discard block |
||
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $name = date('Y_m_d_His') .'_create_admins_table.php'; |
|
| 72 | + $name = date('Y_m_d_His').'_create_admins_table.php'; |
|
| 73 | 73 | shell_exec(sprintf( |
| 74 | 74 | 'cp "%s" "%s"', |
| 75 | 75 | base_path('vendor/yaro/jarboe/src/database/migrations/2018_06_28_152903_create_admins_table.php'), |
| 76 | - database_path('migrations/'. $name) |
|
| 76 | + database_path('migrations/'.$name) |
|
| 77 | 77 | )); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | private function isMigrationFilesExist() |
| 81 | 81 | { |
| 82 | - return (bool) glob(database_path('migrations/*_create_admins_table.php')); |
|
| 82 | + return (bool)glob(database_path('migrations/*_create_admins_table.php')); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | private function copyThirdPartyMigrationFiles() |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | private function isThirdPartyMigrationFilesExist() |
| 104 | 104 | { |
| 105 | - return (bool) glob(database_path('migrations/*_create_permission_tables.php')); |
|
| 105 | + return (bool)glob(database_path('migrations/*_create_permission_tables.php')); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | private function publishAssets() |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | if ($this->hasOld()) { |
| 28 | 28 | if ($this->isGroupedRelation()) { |
| 29 | - $option = crc32($this->relations[$relationIndex]['group']) .'~~~'. $option; |
|
| 29 | + $option = crc32($this->relations[$relationIndex]['group']).'~~~'.$option; |
|
| 30 | 30 | } |
| 31 | 31 | return $this->old() == $option; |
| 32 | 32 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $template = $this->isReadonly() ? 'readonly' : 'edit'; |
| 106 | 106 | |
| 107 | - return view('jarboe::crud.fields.radio.'. $template, [ |
|
| 107 | + return view('jarboe::crud.fields.radio.'.$template, [ |
|
| 108 | 108 | 'model' => $model, |
| 109 | 109 | 'field' => $this, |
| 110 | 110 | ])->render(); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | if ($this->hasOld()) { |
| 84 | 84 | if ($this->isGroupedRelation()) { |
| 85 | - $option = crc32($this->relations[$relationIndex]['group']) .'~~~'. $option; |
|
| 85 | + $option = crc32($this->relations[$relationIndex]['group']).'~~~'.$option; |
|
| 86 | 86 | } |
| 87 | 87 | if ($this->isMultiple()) { |
| 88 | 88 | return in_array($option, $this->old()); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | if (is_null($model)) { |
| 94 | - return (string) $option === (string) $this->getDefault(); |
|
| 94 | + return (string)$option === (string)$this->getDefault(); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | if ($this->isMultiple() && !$this->isRelationField()) { |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | return false; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - return (string) $option === (string) $model->{$this->name}; |
|
| 116 | + return (string)$option === (string)$model->{$this->name}; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | public function relationSearch(\Closure $callback) |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | { |
| 175 | 175 | $template = $this->isReadonly() ? 'readonly' : 'edit'; |
| 176 | 176 | |
| 177 | - return view('jarboe::crud.fields.select.'. $template, [ |
|
| 177 | + return view('jarboe::crud.fields.select.'.$template, [ |
|
| 178 | 178 | 'model' => $model, |
| 179 | 179 | 'field' => $this, |
| 180 | 180 | ])->render(); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | { |
| 192 | 192 | $filtered = []; |
| 193 | 193 | foreach ($ids as $id) { |
| 194 | - if (strpos($id, $relationHash .'~~~') !== false) { |
|
| 194 | + if (strpos($id, $relationHash.'~~~') !== false) { |
|
| 195 | 195 | $id = substr($id, 13); |
| 196 | 196 | $filtered[] = $id; |
| 197 | 197 | } |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | public function getSelectedOptions(array $values, int $index = 0): array |
| 78 | 78 | { |
| 79 | 79 | $total = 0; |
| 80 | - $options = $this->field()->getOptions(null, null, null, $total, $index, function ($query, $related) use ($values) { |
|
| 81 | - $query->whereIn($related->getTable() .'.'. $related->getKeyName(), $values); |
|
| 80 | + $options = $this->field()->getOptions(null, null, null, $total, $index, function($query, $related) use ($values) { |
|
| 81 | + $query->whereIn($related->getTable().'.'.$related->getKeyName(), $values); |
|
| 82 | 82 | }); |
| 83 | 83 | |
| 84 | 84 | return $options; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $relationClass = new $relationClass; |
| 164 | 164 | |
| 165 | 165 | $query->whereHas($this->field()->getRelationMethod($index), function($query) use($values, $relationClass, $relationQuery) { |
| 166 | - $query->whereIn($relationQuery->getTable() .'.'. $relationClass->getKeyName(), $values); |
|
| 166 | + $query->whereIn($relationQuery->getTable().'.'.$relationClass->getKeyName(), $values); |
|
| 167 | 167 | }); |
| 168 | 168 | } |
| 169 | 169 | } |