lundi 24 juin 2019

How to use select in Laravel to get related field value?

I have the following code:

 return Visitor::with("checker")->select(
            'idVisitor', 
            'firstname', 
            'lastname', 
            'middlename',
            'birthday',             
            'document_number', 
            'pincode', 
            'company', 
            'idEvent',
            'code',
            'checker.name' 
            'status'
            )->whereIn("idVisitor", $this->ids)->get();

As you can see I use related model: with("checker").

How to get this field value in select()?

I tried: 'checker.name'



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire