| Conditions | 1 |
| Paths | 1 |
| Total Lines | 78 |
| Code Lines | 64 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 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 |
||
| 13 | public function up() |
||
| 14 | { |
||
| 15 | Schema::create('histories', function (Blueprint $table) { |
||
| 16 | $table->id(); |
||
| 17 | $table->bigInteger('user_id')->default(0); |
||
| 18 | $table->string('content'); |
||
| 19 | $table->timestamps(); |
||
| 20 | }); |
||
| 21 | Schema::create('comments', function (Blueprint $table) { |
||
| 22 | $table->id(); |
||
| 23 | $table->morphs('commentable'); |
||
| 24 | $table->string('content'); |
||
| 25 | $table->tinyInteger('status')->default(0); |
||
| 26 | $table->timestamps(); |
||
| 27 | }); |
||
| 28 | Schema::create('countries', function (Blueprint $table) { |
||
| 29 | $table->id(); |
||
| 30 | $table->string('name')->default(''); |
||
| 31 | $table->timestamps(); |
||
| 32 | }); |
||
| 33 | Schema::create('images', function (Blueprint $table) { |
||
| 34 | $table->id(); |
||
| 35 | $table->string('url')->default(''); |
||
| 36 | $table->morphs('imageable'); |
||
| 37 | $table->timestamps(); |
||
| 38 | }); |
||
| 39 | Schema::create('phones', function (Blueprint $table) { |
||
| 40 | $table->id(); |
||
| 41 | $table->bigInteger('user_id')->default(0); |
||
| 42 | $table->string('phone_number')->default(''); |
||
| 43 | $table->timestamps(); |
||
| 44 | }); |
||
| 45 | Schema::create('roles', function (Blueprint $table) { |
||
| 46 | $table->id(); |
||
| 47 | $table->string('name'); |
||
| 48 | $table->timestamps(); |
||
| 49 | }); |
||
| 50 | Schema::create('role_user', function (Blueprint $table) { |
||
| 51 | $table->id(); |
||
| 52 | $table->bigInteger('user_id')->default(0); |
||
| 53 | $table->bigInteger('role_id')->default(0); |
||
| 54 | $table->timestamps(); |
||
| 55 | }); |
||
| 56 | Schema::create('suppliers', function (Blueprint $table) { |
||
| 57 | $table->id(); |
||
| 58 | $table->string('name')->default(''); |
||
| 59 | $table->timestamps(); |
||
| 60 | }); |
||
| 61 | Schema::create('tags', function (Blueprint $table) { |
||
| 62 | $table->id(); |
||
| 63 | $table->string('name')->default(''); |
||
| 64 | $table->timestamps(); |
||
| 65 | }); |
||
| 66 | Schema::create('taggables', function (Blueprint $table) { |
||
| 67 | $table->id(); |
||
| 68 | $table->bigInteger('tag_id')->default(0); |
||
| 69 | $table->morphs('taggable'); |
||
| 70 | $table->timestamps(); |
||
| 71 | }); |
||
| 72 | Schema::create('users', function (Blueprint $table) { |
||
| 73 | $table->id(); |
||
| 74 | $table->string('username')->default(''); |
||
| 75 | $table->tinyInteger('age')->default(0); |
||
| 76 | $table->bigInteger('country_id')->default(0); |
||
| 77 | $table->bigInteger('supplier_id')->default(0); |
||
| 78 | $table->timestamps(); |
||
| 79 | }); |
||
| 80 | Schema::create('videos', function (Blueprint $table) { |
||
| 81 | $table->id(); |
||
| 82 | $table->string('name')->default(''); |
||
| 83 | $table->timestamps(); |
||
| 84 | }); |
||
| 85 | Schema::create('posts', function (Blueprint $table) { |
||
| 86 | $table->id(); |
||
| 87 | $table->bigInteger('user_id')->default(0); |
||
| 88 | $table->string('title')->default(''); |
||
| 89 | $table->integer('votes')->default(0); |
||
| 90 | $table->timestamps(); |
||
| 91 | }); |
||
| 116 |