add migration provider table
This commit is contained in:
@@ -118,4 +118,9 @@ class Organization extends Model
|
||||
{
|
||||
return $this->hasOne(ClaimHistoryCare::class, 'organization_id', 'id');
|
||||
}
|
||||
|
||||
public function providers()
|
||||
{
|
||||
return $this->hasMany(Provider::class, 'organization_id', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
38
app/Models/Provider.php
Normal file
38
app/Models/Provider.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Blameable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Provider extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes, Blameable;
|
||||
|
||||
protected $fillable = [
|
||||
'organization_id',
|
||||
'name',
|
||||
'code',
|
||||
'header_token',
|
||||
'username',
|
||||
'password',
|
||||
'status',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
'deleted_by',
|
||||
];
|
||||
|
||||
public function organization()
|
||||
{
|
||||
return $this->belongsTo(Organization::class, 'organization_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('providers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('organization_id')->index();
|
||||
$table->string('name');
|
||||
$table->string('code');
|
||||
$table->string('header_token')->nullable();
|
||||
$table->string('username');
|
||||
$table->text('password');
|
||||
$table->string('status')->default('active');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
$table->foreignId('created_by')->nullable();
|
||||
$table->foreignId('updated_by')->nullable();
|
||||
$table->foreignId('deleted_by')->nullable();
|
||||
|
||||
$table->unique(['organization_id', 'code']);
|
||||
$table->foreign('organization_id')->references('id')->on('organizations')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('providers');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user