refactor: 修复知识库和操作指引
This commit is contained in:
22
app/Filament/Resources/GuideResource/Pages/CreateGuide.php
Normal file
22
app/Filament/Resources/GuideResource/Pages/CreateGuide.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\GuideResource\Pages;
|
||||
|
||||
use App\Filament\Resources\GuideResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateGuide extends CreateRecord
|
||||
{
|
||||
protected static string $resource = GuideResource::class;
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
$data['created_by'] = auth()->id();
|
||||
|
||||
if ($data['status'] === 'published') {
|
||||
$data['published_at'] = now();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user