mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-03-14 20:39:44 +01:00
Create IncidentTemplate migration and model.
This commit is contained in:
parent
cbb7032119
commit
0bb95937b0
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateIncidentTemplatesTable extends Migration {
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('incident_templates', function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->string('name')->nullable(false);
|
||||
$table->string('slug', 50)->nullable(false);
|
||||
$table->longText('template')->nullable(false);
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('slug');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('incident_templates');
|
||||
}
|
||||
|
||||
}
|
11
app/models/IncidentTemplate.php
Normal file
11
app/models/IncidentTemplate.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
class IncidentTemplate extends Eloquemt {
|
||||
public static function boot() {
|
||||
parent::boot();
|
||||
|
||||
self::on('saving', function($template) {
|
||||
$template->slug = Str::slug($template->name);
|
||||
});
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user