mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-03-14 20:39:44 +01:00
commit
778547b2c9
@ -70,6 +70,7 @@ class CreateIncidentCommandHandler
|
||||
public function handle(CreateIncidentCommand $command)
|
||||
{
|
||||
$data = [
|
||||
'user_id' => $this->auth->user()->id,
|
||||
'name' => $command->name,
|
||||
'status' => $command->status,
|
||||
'visible' => $command->visible,
|
||||
|
@ -85,6 +85,7 @@ class DemoSeederCommand extends Command
|
||||
return;
|
||||
}
|
||||
|
||||
$this->seedUsers();
|
||||
$this->seedActions();
|
||||
$this->seedComponentGroups();
|
||||
$this->seedComponents();
|
||||
@ -95,7 +96,6 @@ class DemoSeederCommand extends Command
|
||||
$this->seedSchedules();
|
||||
$this->seedSettings();
|
||||
$this->seedSubscribers();
|
||||
$this->seedUsers();
|
||||
|
||||
$this->info('Database seeded with demo data successfully!');
|
||||
}
|
||||
@ -223,6 +223,7 @@ EINCIDENT;
|
||||
'component_id' => 0,
|
||||
'visible' => 1,
|
||||
'stickied' => false,
|
||||
'user_id' => 1,
|
||||
'occurred_at' => Carbon::now(),
|
||||
],
|
||||
[
|
||||
@ -232,6 +233,7 @@ EINCIDENT;
|
||||
'component_id' => 0,
|
||||
'visible' => 1,
|
||||
'stickied' => false,
|
||||
'user_id' => 1,
|
||||
'occurred_at' => Carbon::now(),
|
||||
],
|
||||
];
|
||||
|
@ -74,6 +74,7 @@ class Incident extends Model implements HasPresenter
|
||||
* @var string[]
|
||||
*/
|
||||
protected $casts = [
|
||||
'user_id' => 'int',
|
||||
'visible' => 'int',
|
||||
'stickied' => 'bool',
|
||||
'occurred_at' => 'datetime',
|
||||
@ -86,6 +87,7 @@ class Incident extends Model implements HasPresenter
|
||||
* @var string[]
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'component_id',
|
||||
'name',
|
||||
'status',
|
||||
@ -103,6 +105,7 @@ class Incident extends Model implements HasPresenter
|
||||
* @var string[]
|
||||
*/
|
||||
public $rules = [
|
||||
'user_id' => 'required|int',
|
||||
'component_id' => 'nullable|int',
|
||||
'name' => 'required|string',
|
||||
'status' => 'required|int',
|
||||
@ -118,6 +121,7 @@ class Incident extends Model implements HasPresenter
|
||||
*/
|
||||
protected $searchable = [
|
||||
'id',
|
||||
'user_id',
|
||||
'component_id',
|
||||
'name',
|
||||
'status',
|
||||
@ -132,6 +136,7 @@ class Incident extends Model implements HasPresenter
|
||||
*/
|
||||
protected $sortable = [
|
||||
'id',
|
||||
'user_id',
|
||||
'name',
|
||||
'status',
|
||||
'visible',
|
||||
@ -180,6 +185,16 @@ class Incident extends Model implements HasPresenter
|
||||
return $this->hasMany(IncidentUpdate::class)->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all visible incidents.
|
||||
*
|
||||
|
@ -83,6 +83,16 @@ class IncidentUpdate extends Model implements HasPresenter
|
||||
return $this->belongsTo(Incident::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user relation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the presenter class.
|
||||
*
|
||||
|
@ -45,6 +45,7 @@ $factory->define(ComponentGroup::class, function ($faker) {
|
||||
$factory->define(Incident::class, function ($faker) {
|
||||
return [
|
||||
'name' => $faker->sentence(),
|
||||
'user_id' => factory(User::class)->create()->id,
|
||||
'message' => $faker->paragraph(),
|
||||
'status' => mt_rand(1, 4),
|
||||
'visible' => 1,
|
||||
|
@ -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 AlterIncidentsAddUserId extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('incidents', function (Blueprint $table) {
|
||||
$table->integer('user_id')->unsigned()->nullable()->default(null)->index()->after('id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('incidents', function (Blueprint $table) {
|
||||
$table->dropColumn('user_id');
|
||||
});
|
||||
}
|
||||
}
|
@ -35,6 +35,7 @@ return [
|
||||
'failure' => 'Something went wrong updating the incident update',
|
||||
],
|
||||
],
|
||||
'reported_by' => 'Reported by :user',
|
||||
'add' => [
|
||||
'title' => 'Report an incident',
|
||||
'success' => 'Incident added.',
|
||||
|
@ -24,7 +24,10 @@
|
||||
<div class="col-xs-6">
|
||||
<i class="{{ $incident->icon }}"></i> <strong>{{ $incident->name }}</strong> <span class="badge badge-info">{{ trans_choice('dashboard.incidents.updates.count', $incident->updates()->count()) }}</span>
|
||||
@if($incident->message)
|
||||
<p><small>{{ Str::words($incident->message, 5) }}</small></p>
|
||||
<p>{{ Str::words($incident->message, 5) }}</p>
|
||||
@endif
|
||||
@if ($incident->user)
|
||||
<p><small>— {{ trans('dashboard.incidents.reported_by', ['user' => $incident->user->username]) }}</small></p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="col-xs-6 text-right">
|
||||
|
Loading…
x
Reference in New Issue
Block a user