mercredi 21 juillet 2021

Property [fechaviso] does not exist on this collection instance

i am new to laravel, i need help with this error Property [fechaviso] does not exist on this collection instance

public function retiro (Request $request){
    $data = [
        'category_name' => 'datatable',
        'page_name' => 'miscellaneous',
    'has_scrollspy' => 0,
    'scrollspy_offset' => '',

    ];
    $registros = Registro::whereNull('retiro')
    ->whereNull('retiro')
    ->get();
    $hoy = Carbon::now();
    $update = Registro::where('id', $request->id)->first();
    

   //fecha1 = date
   //fecha2 = today

    $fecha1= $registros->fechaviso;
   $fecha2= new DateTime();
  $contadorfecha = $fecha1->diff($fecha2);    

  
    if ($request->isMethod('put')) {
        if ($update->retiro = $request->retiro)
        {
            $update->fecharetiro = Carbon::now();
       }
        $update->save();
        return redirect('retirados');
    }
  
    return view('retiro',compact('registros','update','hoy','contadorfecha'))->with($data);
    
}

i calculating the difference between days

    @foreach($registros as $registro)
                                 
                                  
                                   
                                     
                                            <tr>
                                                <td class="checkbox-column"> 1 </td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td><span class="shadow-none badge badge-primary"></span></td>
                                                <td class="text-center">
                                            </td>
                                            </tr>
                                       
                                    
                              
                                        @endforeach

DB > https://i.stack.imgur.com/sCXHi.png

I should be able to calculate the days difference, I tried this query but it did not work: Registro::find($request->id); Help pls



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3wXmTb1
via IFTTT

Aucun commentaire:

Enregistrer un commentaire