Conditions | 1 |
Paths | 1 |
Total Lines | 52 |
Lines | 0 |
Ratio | 0 % |
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 |
||
14 | public function up() |
||
15 | { |
||
16 | Schema::create('projects', function (Blueprint $table) { |
||
17 | $table->bigIncrements('id'); |
||
18 | |||
19 | $table->foreignId('author_id')->nullable() |
||
20 | ->references(user_model()->getKeyName()) |
||
21 | ->on(user_model()->getTable()); |
||
22 | |||
23 | $table->foreignId('owner_id')->nullable() |
||
24 | ->references(user_model()->getKeyName()) |
||
25 | ->on(user_model()->getTable()); |
||
26 | |||
27 | $table->foreignId('status_id')->nullable() |
||
28 | ->references('id') |
||
29 | ->on('statuses'); |
||
30 | |||
31 | $table->string('title'); |
||
32 | $table->text('description')->nullable(); |
||
33 | $table->text('notes')->nullable(); |
||
34 | $table->integer('visible')->default(1)->nullable(); |
||
35 | |||
36 | $table->timestamp('started_at')->nullable(); |
||
37 | $table->timestamp('delivered_at')->nullable(); |
||
38 | $table->timestamp('expected_at')->nullable(); |
||
39 | |||
40 | $table->timestamps(); |
||
41 | $table->softDeletes(); |
||
42 | }); |
||
43 | |||
44 | Schema::create('projectables', function (Blueprint $table) { |
||
45 | $table->increments('id'); |
||
46 | $table->integer('project_id'); |
||
47 | $table->integer('projectable_id'); |
||
48 | $table->string('projectable_type'); |
||
49 | }); |
||
50 | |||
51 | Schema::create('project_users', function (Blueprint $table) { |
||
52 | $table->increments('id'); |
||
53 | |||
54 | $table->foreignId('project_id') |
||
55 | ->references('id') |
||
56 | ->on('projects'); |
||
57 | |||
58 | $table->foreignId('user_id') |
||
59 | ->references(user_model()->getKeyName()) |
||
60 | ->on(user_model()->getTable()); |
||
61 | |||
62 | $table->string('status')->nullable(); |
||
63 | $table->string('role')->nullable(); |
||
64 | }); |
||
65 | } |
||
66 | |||
81 |