added extra fields to accounts
This commit is contained in:
parent
cec6a23397
commit
dc10a751c6
|
|
@ -26,14 +26,14 @@ class Account extends Model
|
|||
// public $timestamps = false;
|
||||
protected $guarded = [];
|
||||
protected $fillable = [
|
||||
'contacts', 'bank', 'vat', 'country_id', 'legalization_number', 'type', 'expires_at'
|
||||
'contacts', 'bank', 'vat', 'country_id', 'legalization_number', 'type', 'expires_at', 'broker_expires_at', 'broker_number'
|
||||
];
|
||||
protected $casts = [
|
||||
'contacts' => 'array',
|
||||
'bank' => 'array'
|
||||
];
|
||||
// protected $hidden = [];
|
||||
protected $dates = ['expires_at'];
|
||||
protected $dates = ['expires_at', 'broker_expires_at'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
@ -149,17 +149,17 @@ public function getCanExtendBrokerAttribute()
|
|||
{
|
||||
$month = Config::get('settings.legalization_extend') ?? 1;
|
||||
|
||||
if($application = $this->last_broker_application()){
|
||||
return $application->state == 'approved' && $this->expires_at->lte(Carbon::now()->subMonths($month));
|
||||
if($broker_application = $this->last_broker_application()){
|
||||
return $broker_application->state == 'approved' && $this->broker_expires_at->lte(Carbon::now()->subMonths($month));
|
||||
}
|
||||
|
||||
return !empty($this->legalization_number) && !empty( $this->expires_at) && $this->expires_at->gte(Carbon::now()->subMonths($month));
|
||||
return !empty($this->broker_number) && !empty( $this->broker_expires_at) && $this->broker_expires_at->gte(Carbon::now()->subMonths($month));
|
||||
}
|
||||
|
||||
public function getApplicationBrokerStatusAttribute(){
|
||||
$application = $this->last_broker_application();
|
||||
$broker_application = $this->last_broker_application();
|
||||
|
||||
return $application->state ?? null;
|
||||
return $broker_application->state ?? null;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
<?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::table('accounts', function (Blueprint $table) {
|
||||
$table->date('broker_expires_at')->nullable();
|
||||
$table->string('broker_number')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('accounts', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue