Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add notifications column to incidents #3103

Merged
merged 1 commit into from
Jun 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 27 additions & 14 deletions app/Models/Incident.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,30 @@ class Incident extends Model implements HasPresenter
'is_resolved',
];

/**
* The model's attributes.
*
* @var string[]
*/
protected $attributes = [
'stickied' => false,
'notifications' => false,
];

/**
* The attributes that should be casted to native types.
*
* @var string[]
*/
protected $casts = [
'component_id'=> 'int',
'status' => 'int',
'user_id' => 'int',
'visible' => 'int',
'stickied' => 'bool',
'occurred_at' => 'datetime',
'deleted_at' => 'date',
'component_id' => 'int',
'status' => 'int',
'user_id' => 'int',
'visible' => 'int',
'stickied' => 'bool',
'notifications' => 'bool',
'occurred_at' => 'datetime',
'deleted_at' => 'date',
];

/**
Expand All @@ -96,6 +107,7 @@ class Incident extends Model implements HasPresenter
'status',
'visible',
'stickied',
'notifications',
'message',
'occurred_at',
'created_at',
Expand All @@ -108,13 +120,14 @@ class Incident extends Model implements HasPresenter
* @var string[]
*/
public $rules = [
'user_id' => 'required|int',
'component_id' => 'nullable|int',
'name' => 'required|string',
'status' => 'required|int',
'visible' => 'required|bool',
'stickied' => 'required|bool',
'message' => 'required|string',
'user_id' => 'required|int',
'component_id' => 'nullable|int',
'name' => 'required|string',
'status' => 'required|int',
'visible' => 'required|bool',
'stickied' => 'required|bool',
'notifications' => 'nullable|bool',
'message' => 'required|string',
];

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AlterIncidentsAddNotifications extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('incidents', function (Blueprint $table) {
$table->boolean('notifications')->default(false)->after('stickied');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('incidents', function (Blueprint $table) {
$table->dropColumn('notifications');
});
}
}