| Conditions | 1 |
| Paths | 1 |
| Total Lines | 79 |
| Lines | 42 |
| Ratio | 53.16 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 22 | public function up() |
||
| 23 | { |
||
| 24 | Schema::create(config('admin.database.users_table'), function (Blueprint $table) { |
||
| 25 | $table->increments('id'); |
||
| 26 | $table->string('username', 190)->unique(); |
||
| 27 | $table->string('password', 60); |
||
| 28 | $table->string('name'); |
||
| 29 | $table->string('avatar')->nullable(); |
||
| 30 | $table->string('remember_token', 100)->nullable(); |
||
| 31 | $table->timestamps(); |
||
| 32 | }); |
||
| 33 | |||
| 34 | Schema::create(config('admin.database.roles_table'), function (Blueprint $table) { |
||
| 35 | $table->increments('id'); |
||
| 36 | $table->string('name', 50)->unique(); |
||
| 37 | $table->string('slug', 50)->unique(); |
||
| 38 | $table->timestamps(); |
||
| 39 | }); |
||
| 40 | |||
| 41 | Schema::create(config('admin.database.permissions_table'), function (Blueprint $table) { |
||
| 42 | $table->increments('id'); |
||
| 43 | $table->string('name', 50)->unique(); |
||
| 44 | $table->string('slug', 50)->unique(); |
||
| 45 | $table->string('http_method')->nullable(); |
||
| 46 | $table->text('http_path')->nullable(); |
||
| 47 | $table->timestamps(); |
||
| 48 | }); |
||
| 49 | |||
| 50 | Schema::create(config('admin.database.menu_table'), function (Blueprint $table) { |
||
| 51 | $table->increments('id'); |
||
| 52 | $table->integer('parent_id')->default(0); |
||
| 53 | $table->integer('order')->default(0); |
||
| 54 | $table->string('title', 50); |
||
| 55 | $table->string('icon', 50); |
||
| 56 | $table->string('uri', 50)->nullable(); |
||
| 57 | $table->string('permission')->nullable(); |
||
| 58 | |||
| 59 | $table->timestamps(); |
||
| 60 | }); |
||
| 61 | |||
| 62 | Schema::create(config('admin.database.role_users_table'), function (Blueprint $table) { |
||
| 63 | $table->integer('role_id'); |
||
| 64 | $table->integer('user_id'); |
||
| 65 | $table->index(['role_id', 'user_id']); |
||
| 66 | $table->timestamps(); |
||
| 67 | }); |
||
| 68 | |||
| 69 | Schema::create(config('admin.database.role_permissions_table'), function (Blueprint $table) { |
||
| 70 | $table->integer('role_id'); |
||
| 71 | $table->integer('permission_id'); |
||
| 72 | $table->index(['role_id', 'permission_id']); |
||
| 73 | $table->timestamps(); |
||
| 74 | }); |
||
| 75 | |||
| 76 | Schema::create(config('admin.database.user_permissions_table'), function (Blueprint $table) { |
||
| 77 | $table->integer('user_id'); |
||
| 78 | $table->integer('permission_id'); |
||
| 79 | $table->index(['user_id', 'permission_id']); |
||
| 80 | $table->timestamps(); |
||
| 81 | }); |
||
| 82 | |||
| 83 | Schema::create(config('admin.database.role_menu_table'), function (Blueprint $table) { |
||
| 84 | $table->integer('role_id'); |
||
| 85 | $table->integer('menu_id'); |
||
| 86 | $table->index(['role_id', 'menu_id']); |
||
| 87 | $table->timestamps(); |
||
| 88 | }); |
||
| 89 | |||
| 90 | Schema::create(config('admin.database.operation_log_table'), function (Blueprint $table) { |
||
| 91 | $table->increments('id'); |
||
| 92 | $table->integer('user_id'); |
||
| 93 | $table->string('path'); |
||
| 94 | $table->string('method', 10); |
||
| 95 | $table->string('ip'); |
||
| 96 | $table->text('input'); |
||
| 97 | $table->index('user_id'); |
||
| 98 | $table->timestamps(); |
||
| 99 | }); |
||
| 100 | } |
||
| 101 | |||
| 120 |