2025-05-24 21:08:04 +07:00

56 lines
1.4 KiB
PHP

<?php
namespace App\Filament\Resources\StudentResource\Pages;
use App\Filament\Resources\StudentResource;
use App\Models\Student;
use App\Models\User;
use Filament\Actions;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\CreateRecord;
class CreateStudent extends CreateRecord
{
protected static string $resource = StudentResource::class;
// protected function mutateFormDataBeforeCreate(array $data): array
// {
//// $user = User::firstOrCreate(
//// ['email' => 'teacher@example.com'],
//// [
//// 'name' => 'teacher',
//// 'password' => bcrypt('teacher'),
//// ]
//// );
////
// $birthDate = explode('-', $data['birth_date']);
//
//
// $password = join("", $birthDate) . '-' . $data['nis'];
//
// $add = [
// 'email' => $data['email'],
// 'name' => $data['parent_name'],
// 'password' => $password,
// ];
//
// dd($add);
// die;
//
// $exists = Student::where('name', $data['name'])
// ->exists();
//
// if ($exists) {
// Notification::make()
// ->title('Failed to save')
// ->body('A record already exists.')
// ->danger()
// ->send();
//
// $this->halt(); // Stop the save process
// }
//
// return $data;
// }
}