26 lines
705 B
PHP
26 lines
705 B
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Contracts\Pages;
|
|
|
|
use App\Filament\Resources\Contracts\ContractResource;
|
|
use App\Services\ContractScheduleService;
|
|
use Filament\Resources\Pages\CreateRecord;
|
|
|
|
class CreateContract extends CreateRecord
|
|
{
|
|
protected static string $resource = ContractResource::class;
|
|
|
|
protected function afterCreate(): void
|
|
{
|
|
$contract = $this->record;
|
|
$templateId = $this->data['payment_template_id'] ?? null;
|
|
|
|
if ($templateId) {
|
|
$template = \App\Models\PaymentTemplate::find($templateId);
|
|
if ($template) {
|
|
ContractScheduleService::generateFromTemplate($contract, $template);
|
|
}
|
|
}
|
|
}
|
|
}
|