Mass changes
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Activity extends Model
|
||||
{
|
||||
@@ -43,9 +42,11 @@ protected static function booted()
|
||||
|
||||
// If an activity with a due date is added for a contract, update the related account's promise_date
|
||||
if (! empty($activity->contract_id) && ! empty($activity->due_date)) {
|
||||
DB::table('accounts')
|
||||
\App\Models\Account::query()
|
||||
->where('contract_id', $activity->contract_id)
|
||||
->update(['promise_date' => $activity->due_date, 'updated_at' => now()]);
|
||||
->update(
|
||||
['promise_date' => $activity->due_date, 'updated_at' => now()],
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Email extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'person_id',
|
||||
|
||||
@@ -19,8 +19,14 @@ class FieldJobSetting extends Model
|
||||
'cancel_decision_id',
|
||||
'return_segment_id',
|
||||
'queue_segment_id',
|
||||
'action_id',
|
||||
];
|
||||
|
||||
public function action(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Action::class);
|
||||
}
|
||||
|
||||
public function segment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Segment::class);
|
||||
@@ -28,22 +34,34 @@ public function segment(): BelongsTo
|
||||
|
||||
public function assignDecision(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Decision::class, 'assign_decision_id');
|
||||
return $this->belongsTo(Decision::class, 'assign_decision_id')
|
||||
->with(['actions' => function ($query) {
|
||||
$query->select('actions.id');
|
||||
}]);
|
||||
}
|
||||
|
||||
public function initialDecision(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Decision::class, 'initial_decision_id');
|
||||
return $this->belongsTo(Decision::class, 'initial_decision_id')
|
||||
->with(['actions' => function ($query) {
|
||||
$query->select('actions.id');
|
||||
}]);
|
||||
}
|
||||
|
||||
public function completeDecision(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Decision::class, 'complete_decision_id');
|
||||
return $this->belongsTo(Decision::class, 'complete_decision_id')
|
||||
->with(['actions' => function ($query) {
|
||||
$query->select('actions.id');
|
||||
}]);
|
||||
}
|
||||
|
||||
public function cancelDecision(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Decision::class, 'cancel_decision_id');
|
||||
return $this->belongsTo(Decision::class, 'cancel_decision_id')
|
||||
->with(['actions' => function ($query) {
|
||||
$query->select('actions.id');
|
||||
}]);
|
||||
}
|
||||
|
||||
public function returnSegment(): BelongsTo
|
||||
|
||||
@@ -11,7 +11,7 @@ class ImportRow extends Model
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'import_id','row_number','sheet_name','record_type','raw_data','mapped_data','status','errors','warnings','entity_type','entity_id','fingerprint'
|
||||
'import_id', 'row_number', 'sheet_name', 'record_type', 'raw_data', 'mapped_data', 'status', 'errors', 'warnings', 'entity_type', 'entity_id', 'fingerprint', 'raw_sha1',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
|
||||
Reference in New Issue
Block a user