Added member state migration and model.
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class MemberState extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateMemberStatesTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('member_states', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
|
||||||
|
// Ther person id the member dates belong to.
|
||||||
|
// IF the corresponding person is deleted, all the member dates are
|
||||||
|
// deleted, too.
|
||||||
|
$table->integer('person_id')->unsigned();
|
||||||
|
$table->foreign('person_id')->references('id')->on('people')
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
// The date of joining
|
||||||
|
$table->date('joining_date');
|
||||||
|
|
||||||
|
// The date of leaving
|
||||||
|
$table->date('leaving_date')->nullable();
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('member_states');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user