Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Apr 26, 2024
1 parent ccbbdef commit 3fc7ea3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public static function table(Table $table): Table
Tables\Columns\TextColumn::make('user')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('hostingSubscription.domain')
->searchable()
->sortable(),
])
->filters([
//
Expand Down
8 changes: 8 additions & 0 deletions web/app/Models/CronJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class CronJob extends Model
'schedule',
'command',
'user',
'hosting_subscription_id'
];

protected static function booted(): void
Expand All @@ -35,6 +36,12 @@ public static function boot()
parent::boot();

static::creating(function ($model) {
if ($model->hosting_subscription_id) {
$hostingSubscription = HostingSubscription::where('id', $model->hosting_subscription_id)->first();
if ($hostingSubscription) {
$model->user = $hostingSubscription->system_username;
}
}
$allCronJobs = [];
$oldCronJobs = self::where('user', $model->user)->get();
foreach ($oldCronJobs as $oldCronJob) {
Expand Down Expand Up @@ -101,4 +108,5 @@ public function configureCronJobs($cronJobs)
return false;
}


}

0 comments on commit 3fc7ea3

Please sign in to comment.