alonemz
print action
i have add new question sir related to filament can you see that https://discord.com/channels/883083792112300104/1244701110586048613
9 replies
Resource page that can share the same Model
public function table(Table $table): Table
{
// Get the user ID
$userId = $this->getOwnerRecord()->user_id;
// Retrieve medical records for the user
$medicalRecords = MedicalRecord::where('user_id', $userId)->get();
// Get the medical record IDs
$medicalRecordIds = $medicalRecords->pluck('id');
// Retrieve vital signs for the medical records
$vitalSigns = VitalSign::whereIn('medical_record_id', $medicalRecordIds)->get();
// Map the vital signs data
$data = $vitalSigns->map(function ($vitalSign) {
return [
'user_id' => $vitalSign->user_id,
'temperature' => $vitalSign->temperature,
'blood_pressure' => $vitalSign->blood_pressure,
'heart_rate' => $vitalSign->heart_rate,
'respiratory_rate' => $vitalSign->respiratory_rate,
'oxygen_saturation' => $vitalSign->oxygen_saturation,
];
});
return $table
->viewData(['data' => $data])
->columns([
TextColumn::make('user_id')->label('Patient ID'),
TextColumn::make('temperature')->sortable()->searchable(),
TextColumn::make('blood_pressure')->sortable()->searchable(),
TextColumn::make('heart_rate')->sortable()->searchable(),
TextColumn::make('respiratory_rate')->sortable()->searchable(),
TextColumn::make('oxygen_saturation')->sortable()->searchable(),
]); how can i pass?
30 replies
Resource page that can share the same Model
hello public static function form(Form $form): Form
{
$user = auth()->user();
return $form->schema([
Textarea::make('description')->nullable(),
Hidden::make('status')->default('open'),
Hidden::make('user_id')->default($user->id),
Hidden::make('approver_id')->default($user->manager_id),
FileUpload::make('attachment') // Define file validation rules
]);
} i have this form and i want to stor also this to othere db the medical_request_id and also the user_id the requester to medical_record table so
i used like this but not working protected function beforeSave(): void
{
$resource = $this->getResource();
$record = $resource->getCurrentRecord();
// Create a new MedicalRecord instance
$medicalRecord = new MedicalRecord();
// Set the user_id and medical_request_id for the MedicalRecord
$medicalRecord->user_id = $record->user_id;
$medicalRecord->medical_request_id = $record->id;
// Save the MedicalRecord instance
$medicalRecord->save();
}
30 replies
Resource page that can share the same Model
yes i have set this ->databaseNotifications(); to the panel and also i have done the migration but in resorec i set befor save protected function beforeCreate(): void
{
Notification::make()
->success()
->title('User Created , You Need focus ')
->sendToDatabase(auth()->user());
}
like this but cant store
30 replies
Resource page that can share the same Model
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('name')->label('Name')->required(),
TextInput::make('email')->label('Email')->required(),
TextInput::make('phone')->label('Phone')->required(),
TextInput::make('password')->label('password')->required(),
TextInput::make('job_role')->label('Job Role')->required(),
TextInput::make('type')->label('User Type')->required(),
Notification::make()
->success()
->title('User Created , You Need focus ')
->sendToDatabase(auth()->user()),
]);
} hello how can i stor to the db the notificaation
30 replies