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()],
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user