Browse Array with foreach PHP Laravel

Asked

Viewed 14 times

-1

Hello I have the following array that is coming from a Collection of Laravel

[
  {"id":1,"providence_management_id":4,"email":"[email protected]"},
  {"id":2,"providence_management_id":4,"email":"[email protected]"},
  {"id":3,"providence_management_id":4,"email":"[email protected]"}
 ]

I am trying to select all emails to display in a tag format input I’m doing it this way in my view:

<input type="text" data-role="tagsinput" name="email2" id="email2" class="form-control"
    @if(isset($providence_management) )
        @foreach( $providence_management->externalEmails as $key => $value)
            value="{{ $value}}"
        @endforeach
    @endif
  >

Only this loop is only bringing the first email and ignoring the others. It is only displaying the email input [email protected].

Obs. I am working on the screen edit of view,to display items that already exist in the bank. Until you get to this Collection have a relationship HasMany where a register can have several emails that are inserted in tag format.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.