@if(!empty($p['photo']))
@php
$count = count($p['photo']);
$row = 1;
$row_photo = 1;
$col = 6;
@endphp
@foreach($p['photo'] as $photo)
@php
if($count == 2){
if($row == 1 && $row_photo <= 2){
$col = 6;
}else if($row == 2 && $row_photo == 1){
$col = 4;
}else if($row == 2 && $row_photo == 2){
$col = 4;
}else if($row == 2 && $row_photo == 3){
$col = 4;
}else if($row == 3){
$col = 6;
}
}else if($count > 2){
if($row == 1 && $row_photo <= 2){
$col = 6;
}else if($row == 2 && $row_photo == 1){
$col = 4;
}else if($row == 2 && $row_photo == 2){
$col = 4;
}else if($row == 2 && $row_photo == 3){
$col = 4;
}else if($row == 3){
$col = 12;
}
}else if($count == 1){
if($row == 1 && $row_photo == 1){
$col = 12;
}else if($row == 1 && $row_photo == 2){
$col = 6;
}else if($row == 2 && $row_photo == 1){
$col = 12;
}else if($row == 2 && $row_photo == 2){
$col = 4;
}else if($row == 2 && $row_photo == 3){
$col = 4;
}else if($row == 3 && $row_photo == 2){
$col = 6;
}else if($row == 3){
$col = 12;
}
}
@endphp
@php
$count --;
if($row == 1 && $row_photo == 2){
$row = 2;
$row_photo = 0;
}else if($row == 2 && $row_photo == 3){
$row = 3;
$row_photo = 0;
}else if($row == 3 && $count == 1){
$row = 3;
$row_photo = 1;
}else if($row == 3){
$row = 1;
$row_photo = 0;
}
$row_photo ++;
@endphp
@endforeach