From 38acc4e950677dcb4bcf4c497717ddf5f1f7cedf Mon Sep 17 00:00:00 2001 From: Kenneth Halim <kanisiuskenneth@gmail.com> Date: Fri, 2 Mar 2018 13:08:14 +0700 Subject: [PATCH] add user role models --- app/Dosen.php | 12 +++++++ app/Mahasiswa.php | 16 ++++++++++ app/Manajer.php | 10 ++++++ ...8_02_26_094141_create_mahasiswas_table.php | 4 ++- .../2018_03_02_052137_create_dosens_table.php | 32 +++++++++++++++++++ ...018_03_02_052148_create_manajers_table.php | 31 ++++++++++++++++++ 6 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 app/Dosen.php create mode 100644 app/Manajer.php create mode 100644 database/migrations/2018_03_02_052137_create_dosens_table.php create mode 100644 database/migrations/2018_03_02_052148_create_manajers_table.php diff --git a/app/Dosen.php b/app/Dosen.php new file mode 100644 index 0000000..fad6364 --- /dev/null +++ b/app/Dosen.php @@ -0,0 +1,12 @@ +<?php + +namespace App; + +use Illuminate\Database\Eloquent\Model; + +class Dosen extends Model +{ + const STATUS_PENGUJI_2 = 1; + const STATUS_PENGUJI_1 = 2; + const STATUS_PEMBIMBING = 3; +} diff --git a/app/Mahasiswa.php b/app/Mahasiswa.php index 6356000..9ee5319 100644 --- a/app/Mahasiswa.php +++ b/app/Mahasiswa.php @@ -6,5 +6,21 @@ use Illuminate\Database\Eloquent\Model; class Mahasiswa extends Model { + const STATUS_MENUNGGU_TOPIK = 0; + const STATUS_SIAP_SEMINAR_TOPIK = 1; + const STATUS_MENUNGGU_PROPOSAL = 2; + const STATUS_SIAP_SEMINAR_PROPOSAL = 3; + const STATUS_MASA_BIMBINGAN = 4; + const STATUS_SIAP_SEMINAR_TESIS = 5; + const STATUS_SIAP_SIDANG_TESIS = 6; + const STATUS_LULUS = 7; + const STATUS_STRINGS = [ + "Menunggu Topik","Siap Seminar Topik", "Menunggu Proposal", "Siap Seminar Proposal", "Masa Bimbingan", + "Siap Seminar Tesis", "Siap Sidang Tesis", "Lulus" + ]; + public function getStatus($status) { + return Mahasiswa::STATUS_STRINGS[$status]; + } + // } diff --git a/app/Manajer.php b/app/Manajer.php new file mode 100644 index 0000000..6aa9c88 --- /dev/null +++ b/app/Manajer.php @@ -0,0 +1,10 @@ +<?php + +namespace App; + +use Illuminate\Database\Eloquent\Model; + +class Manajer extends Model +{ + // +} diff --git a/database/migrations/2018_02_26_094141_create_mahasiswas_table.php b/database/migrations/2018_02_26_094141_create_mahasiswas_table.php index 984c3dc..bd55b43 100644 --- a/database/migrations/2018_02_26_094141_create_mahasiswas_table.php +++ b/database/migrations/2018_02_26_094141_create_mahasiswas_table.php @@ -14,7 +14,9 @@ class CreateMahasiswasTable extends Migration public function up() { Schema::create('mahasiswas', function (Blueprint $table) { - $table->increments('id'); + $table->unsignedInteger('user_id'); +// $table->integer('status'); + $table->integer('tesis_id'); $table->timestamps(); }); } diff --git a/database/migrations/2018_03_02_052137_create_dosens_table.php b/database/migrations/2018_03_02_052137_create_dosens_table.php new file mode 100644 index 0000000..ff0c6fe --- /dev/null +++ b/database/migrations/2018_03_02_052137_create_dosens_table.php @@ -0,0 +1,32 @@ +<?php + +use Illuminate\Support\Facades\Schema; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreateDosensTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('dosens', function (Blueprint $table) { + $table->unsignedInteger('user_id'); + $table->integer('status'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('dosens'); + } +} diff --git a/database/migrations/2018_03_02_052148_create_manajers_table.php b/database/migrations/2018_03_02_052148_create_manajers_table.php new file mode 100644 index 0000000..e2da69e --- /dev/null +++ b/database/migrations/2018_03_02_052148_create_manajers_table.php @@ -0,0 +1,31 @@ +<?php + +use Illuminate\Support\Facades\Schema; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreateManajersTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('manajers', function (Blueprint $table) { + $table->increments('user_id'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('manajers'); + } +} -- GitLab