Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Branch master (114f68)
by Mark
09:17
created

MarchUpdateOne::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 51
Code Lines 38

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 38
nc 1
nop 0
dl 0
loc 51
rs 9.4109
c 1
b 0
f 0

How to fix   Long Method   

Long Method

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:

1
<?php
2
3
use App\Model\Page;
4
use Illuminate\Support\Facades\Schema;
5
use Illuminate\Database\Schema\Blueprint;
6
use App\Plugins\Newsletters\Model\Newsletter;
7
use Illuminate\Database\Migrations\Migration;
8
9
class MarchUpdateOne extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
10
{
11
    /**
12
     * Run the migrations.
13
     *
14
     * @return void
15
     */
16
    public function up()
17
    {
18
        $plugin = new \App\Model\Plugin();
19
20
        $plugin->setAttribute('name', 'newsletters');
21
        $plugin->setAttribute('enabled', false);
22
        $plugin->setAttribute('is_frontend', true);
23
        $plugin->setAttribute('is_backend', true);
24
        $plugin->setAttribute('required', false);
25
        $plugin->save();
26
27
        Schema::create('newsletters', function (Blueprint $table) {
28
            $table->increments('id');
29
            $table->string('title');
30
            $table->string('content');
31
            $table->integer('emailCount');
32
            $table->boolean('deliveryStatus');
33
            $table->integer('editor_id');
34
            $table->integer('creator_id');
35
            $table->timestamps();
36
        });
37
38
        Schema::create('newsletter_users', function (Blueprint $table) {
39
            $table->increments('id');
40
            $table->string('email', 191)->unique();
41
            $table->timestamps();
42
        });
43
44
        Schema::create('newsletter_templates', function (Blueprint $table) {
45
            $table->increments('id');
46
            $table->integer('editor_id');
47
            $table->integer('creator_id');
48
            $table->softDeletes();
49
            $table->timestamps();
50
        });
51
52
        Schema::table('pages', function (Blueprint $table) {
53
            $table->string('identifier')->nullable()->after('id')->index();
54
            $table->boolean('special')->default(0)->after('editable');
55
        });
56
57
        /** @var Page $page */
58
        $page = app(Page::class);
59
        $page->setAttribute('identifier', Newsletter::VIEW_NEWSLETTER_SUCCESS);
60
        $page->setAttribute('title', 'Thank You Newsletter');
61
        $page->setAttribute('content', '<h1>Newsletter Signup Complete</h1> <p>Thank you for subscribing to our newsletter.</p>');
62
        $page->setAttribute('editable', true);
63
        $page->setAttribute('special', true);
64
        $page->setAttribute('sitemap', false);
65
        $page->setAttribute('enabled', true);
66
        $page->save();
67
    }
68
69
    /**
70
     * Reverse the migrations.
71
     *
72
     * @return void
73
     */
74
    public function down()
75
    {
76
        //
77
    }
78
}
79