CreateAnnouncementsTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 11
c 1
b 0
f 0
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 13 1
A down() 0 3 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Artisan;
6
use Illuminate\Support\Facades\Schema;
7
8
class CreateAnnouncementsTable extends Migration
9
{
10
    /**
11
     * Run the migrations.
12
     *
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        Schema::create('announcements', function (Blueprint $table) {
18
            $table->id();
19
            $table->foreignId('user_id')->constrained()->cascadeOnDelete();
20
            $table->json('medium')->nullable();
21
            $table->json('audience');
22
            $table->boolean('slack_notify')->default(1);
23
            $table->text('body');
24
            $table->timestamps();
25
        });
26
27
        Artisan::call('make:permission Announcement --all');
28
    }
29
30
    /**
31
     * Reverse the migrations.
32
     *
33
     * @return void
34
     */
35
    public function down()
36
    {
37
        Schema::dropIfExists('announcements');
38
    }
39
}
40