Have problem in laravel, i cannot get name by id. (this is not current user)
controller:
$deal_initiator = Reserved::with('from_user')->get();
model:
public function from_user()
{
return $this->belongsTo(User::class ,'from_userid');
}
in blade i got: (by )
[{"id":34,"reserved":1,"from_userid":5,"to_userid":4,"amount":"500","cancelled":0,"cancelled_by":null,"completed":0,"created_at":"2019-11-21 19:07:36","expires_at":"2019-11-22 16:07:36","trackID":"5dd6b6485df74","from_user":{"id":5,"role_id":2,"name":"Max","email":"XXX","avatar":"users\/default.png","email_verified_at":null,"settings":[],"created_at":"2019-04-02 12:33:08","updated_at":"2019-04-02 12:33:08","deleted_at":null,"balance":"600"}}]
i need get field name (Max), how i can get it? Thanks
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2OkNmw2
via IFTTT
Aucun commentaire:
Enregistrer un commentaire