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'



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2NapSv6
via IFTTT

Aucun commentaire:

Enregistrer un commentaire