Created
August 31, 2018 10:20
-
-
Save ferdhika31/0c65b05baf7e5a286dfdca7d01e6d70a to your computer and use it in GitHub Desktop.
Pengajuan Produk Hukum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Support\Facades\Schema; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
use App\Traits\BinarySchemaTrait as BinarySchema; | |
class CreatePengajuanProdukHukumTable extends Migration | |
{ | |
use BinarySchema; | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('pengajuan_produk_hukum', function (Blueprint $table) { | |
// $table->increments('id'); | |
$table->uuid('id')->unique(); | |
$table->string('no_pengajuan', 100); | |
$table->string('deskripsi', 200); | |
$table->string('keterangan', 200); | |
$table->string('file', 200); | |
$table->integer('versi'); | |
$table->string('alasan')->nullable(); | |
$table->integer('user_id')->unsigned(); | |
$table->uuid('status_pengajuan_id'); | |
$table->foreign('user_id') | |
->references('id')->on('users') | |
->onDelete('cascade'); | |
$table->timestamps(); | |
$table->softDeletes(); | |
}); | |
$this->setForeignKey('pengajuan_produk_hukum', 'status_pengajuan_id', 'status_pengajuan', 'id'); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('pengajuan_produk_hukum'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* @Author: Ferdhika Yudira | |
* @Website: http://dika.web.id | |
* @Date: 2018-08-31 10:50:22 | |
* @Email: fer@dika.web.id | |
*/ | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
use App\Traits\Uuid; | |
use Illuminate\Database\Eloquent\SoftDeletes; | |
class PengajuanProdukHukum extends Model | |
{ | |
use Uuid; | |
use SoftDeletes; | |
/** | |
* The table associated with the model. | |
* | |
* @var string | |
*/ | |
protected $table = 'pengajuan_produk_hukum'; | |
/** | |
* The attributes that should be mutated to dates. | |
* | |
* @var array | |
*/ | |
protected $dates = ['deleted_at']; | |
/** | |
* Indicates if the IDs are auto-incrementing. | |
* | |
* @var bool | |
*/ | |
public $incrementing = false; | |
/** | |
* The attributes that are mass assignable. | |
* | |
* @var array | |
*/ | |
protected $fillable = [ | |
'no_pengajuan', | |
'deskripsi', | |
'keterangan', | |
'file', | |
'versi', | |
'aktif', | |
'alasan' | |
]; | |
/** | |
* Get the produkHukum record associated with the pengajuan produk hukum. | |
*/ | |
public function produkHukum() | |
{ | |
return $this->hasOne('App\ProdukHukum'); | |
} | |
/** | |
* Get the statusPengajuan that owns the produk hukum. | |
*/ | |
public function statusPengajuan(){ | |
return $this->belongsTo('App\StatusPengajuan'); | |
} | |
/** | |
* Get the user that owns the album. | |
*/ | |
public function user(){ | |
return $this->belongsTo('App\User'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment