lundi 21 juin 2021

I can't find the user and sum

i have a problem, i need to add the debt of a user

controller:

 public function cliente($id){

        // $nota = App\Nota::find($id);
    
        //Aquí valida si existe sino redirije al 404
        $datos = [
            'category_name' => 'datatable',
            'page_name' => 'multiple_tables',
        'registro' => Registro::find($id),

        ];

        $cliente = \App\Models\User::findOrFail($id);
    
    
        return view('cliente', compact('cliente'))->with($datos);
    }

blade.php

<div class="row">
<div class="col">
  <h4>Debt Sum:</h4>
</div>
<div class="col">
 
</div>

Database:

enter image description here

i need to add the field "deuda" of the user, the relationship is in user_id with the users table

the error that I get is: Trying to get property 'user_id' of non-object

help pls



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire