Skip to content

Instantly share code, notes, and snippets.

@alcir-junior-caju
Created May 29, 2019 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alcir-junior-caju/7d6f5554bf4f65c7f3cfa472f69d137b to your computer and use it in GitHub Desktop.
Save alcir-junior-caju/7d6f5554bf4f65c7f3cfa472f69d137b to your computer and use it in GitHub Desktop.
Laravel View
{
"type": "collective",
"content": [
{
"title": "Título",
"description": "Descrição",
"members": [
{
"photo": "user-1.jpg",
"name": "Nome"
},
{
"photo": "user-2.jpg",
"name": "Nome"
}
]
},
{
"title": "Título",
"description": "Descrição",
"members": [
{
"photo": "user-1.jpg",
"name": "Nome"
},
{
"photo": "user-2.jpg",
"name": "Nome"
}
]
}
]
}
// Primeira Iteração var_dump dentro do RootView.blade.php
array (size=6)
0 =>
object(stdClass)[2402]
public 'photo' => string 'user-1.jpg' (length=10)
public 'name' => string 'Nome' (length=4)
1 =>
object(stdClass)[2403]
public 'photo' => string 'user-2.jpg' (length=10)
public 'name' => string 'Nome' (length=4)
// Segunda Iteração var_dump dentro do RootView.blade.php
array (size=6)
0 =>
object(stdClass)[2409]
public 'photo' => string 'user-1.jpg' (length=10)
public 'name' => string 'Nome' (length=4)
1 =>
object(stdClass)[2410]
public 'photo' => string 'user-2.jpg' (length=10)
public 'name' => string 'Nome' (length=4)
// Primeira Iteração var_dump dentro do module.blade.php
array (size=2)
0 =>
object(stdClass)[2401]
public 'title' => string 'Título' (length=7)
public 'description' => string 'Descrição' (length=11)
public 'members' =>
array (size=2)
0 =>
object(stdClass)[2402]
public 'photo' => string 'user-1.jpg' (length=10)
public 'name' => string 'Nome' (length=4)
1 =>
object(stdClass)[2403]
public 'photo' => string 'user-2.jpg' (length=10)
public 'name' => string 'Nome' (length=4)
// Segunda Iteração var_dump dentro do module.blade.php
0 =>
object(stdClass)[2401]
public 'title' => string 'Título' (length=7)
public 'description' => string 'Descrição' (length=11)
public 'members' =>
array (size=2)
0 =>
object(stdClass)[2402]
public 'photo' => string 'user-1.jpg' (length=10)
public 'name' => string 'Nome' (length=4)
1 =>
object(stdClass)[2403]
public 'photo' => string 'user-2.jpg' (length=10)
public 'name' => string 'Nome' (length=4)
@php
$peoples = $custom->content;
var_dump($peoples);
@endphp
<div class="owl-carousel owl-theme my-5">
@foreach ($peoples as $people)
<div class="item text-center">
<img class="img-fluid rounded-circle" src="{{ $people->photo }}" alt="{{ $people->name }}" />
<h4 class="mt-2">{{ $people->name }}</h4>
@if (isset($people->function))
<span>{{ $people->function }}</span>
@endif
</div>
@endforeach
</div>
<div class="row">
@foreach ($custom->content as $collective)
<div class="col-12 my-4">
<h3>{{ $collective->title }}</h3>
{!! $collective->description !!}
<h4 class="my-5">Membros do Coletivo:</h4>
<div class="row my-3">
{{-- Exibição 1 --}}
@php
$peoples = $collective->members;
var_dump($peoples);
@endphp
{{-- Exibição 2 --}}
@include('modules.people', $collective->members)
@foreach ($collective->members as $member)
<div class="col-12 col-sm-12 col-md-12 col-lg-2 col-xl-2 mb-3 text-center">
<img class="img-fluid rounded-circle" src="{{ $member->photo }}" alt="{{ $member->name }}" />
<h4 class="mt-2">{{ $member->name }}</h4>
</div>
@endforeach
</div>
</div>
@endforeach
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment