PDF generator not working properly

zero942

New member
I have a problem with this code, I am trying to generate a pdf but it won't allow me, I get the following error. This is the place where the error is telling me, although specifically it is here .strtoupper(TPersona::find($this->user->idsupervisor)['nombre_completo_razon_social'])

1739805384973.png


public function Reporte_PDF (Request $request){
//dd($this->user->idsupervisor);
//dd(count($request->filtros));
// return response(public_path(),200);
$title = $request->titulo;
$fecha = Carbon::now();
$operaciones=0;
$html = '
<!DOCTYPE html>
<html>
<body style ="margin:0px; font-size:13px">
<table style="border:solid 1px black; width:100%">
<tr>
<td style =" width:15%" >
<img src="'.public_path().'\img\logo.png" style="height:105px; width:145px" >
</td>
<td style ="margin:0px; width:80%">
<table style="width:100%">
<tr align="left">
<th style="font-size:15px">
SERVICIOS INTEGRALES IF.
</th>
</tr>
<tr>
<td>
SOLICITANTE
</td>
<td style="text-align:right">'
.strtoupper($this->user['nombre_completo_razon_social']).
'</td>
</tr>
<tr>
<td>
SUPERVISOR
</td>
<td style="text-align:right">'
.strtoupper(TPersona::find($this->user->idsupervisor)['nombre_completo_razon_social'])

/*strtoupper($request->supervisor)*/.
'</td>
</tr>
<tr>
<td>
FECHA DE SOLICITUD
</td>
<td style="text-align:right">'
.$fecha.
'</td>
</tr>
<tr>
<td>
EMPRESA
</td>
<td style="text-align:right">'
.strtoupper(TPersona::find($this->user->idempresa_Grupo)['nombre_completo_razon_social'])
/*strtoupper($request->fabricante)*/.
'</td>
</tr>
</table>
</td>
</tr>
</table>
<h3 style= "text-align:center; width:100% "> RESULTADOS DE LA BUSQUEDA DE '.strtoupper($title).'.</h3>
<table style="width:100%, align:center">
<tr>
';


foreach($request->cabecera as $cab){
$html.='<th>';
$html.=strtoupper($cab['text']).'</th>
';
}

I don't know how to solve it

thanks ins advance
 
Last edited:
I have a problem with this code, I am trying to generate a pdf but it won't allow me, I get the following error. This is the place where the error is telling me, although specifically it is here .strtoupper(TPersona::find($this->user->idsupervisor)['nombre_completo_razon_social'])

View attachment 1037




I don't know how to solve it

thanks ins advance
Have a look at this line:
PHP:
$html.=strtoupper($cab['text']).'</th>';
The $request->cabecera array may not be properly initialized or may contain null values. If $request->cabecera is null or if any of its elements do not have the 'text' key, trying to access $cab['text'] will trigger the error.
You can add a check to ensure that $cab is an array and that it contains the 'text' key before attempting to access it.
 
Back
Top