Show buttons

0

I have a table in which it is filled with a foreach and in a column it shows buttons to delete or edit that row

@foreach($clock as $r)
            <tr class="text-center {{ ($r->hours > 480) ? 'bg-warning-soft' : '' }} {{ ($r->hours < 480) ? 'bg-danger-soft' : '' }}">
                <td class="text-left">{{ $r->employee->Name.' '.$r->employee->LastName }}</td>
                <td>{{ $r->inDate }}</td>
                <td>{{ $r->inTime }}</td>
                <td>{{ $r->outDate }}</td>
                <td>{{ $r->outTime }}</td>
                <td width="25%" class="text-center">
                    @if(Auth::user()->groupId == 1)
                        <button type="button" class="btn btn-primary btn-sm"
                                onclick="modalForm('{{ url('/editClock/'.$r['id']) }}', 'Editar marcación');"
                                title="Editar"><img src="img/icons/edit.png"/></button>
                        <button type="button" class="btn btn-info btn-sm"
                                onclick="modalForm('{{ url('/showClockActivity/'.$r['id']) }}', 'Ver Actividades', true);"
                                title="Actividades"><img src="img/icons/doc.png"/></button>
                    @else
                        <button type="button" style="display: none" class="btn btn-primary btn-sm"
                                onclick="modalForm('{{ url('/editClock/'.$r['id']) }}', 'Editar marcación');"
                                title="Editar"><img src="img/icons/edit.png"/></button>
                        <button type="button" style="display: none" class="btn btn-info btn-sm"
                                onclick="modalForm('{{ url('/showClockActivity/'.$r['id']) }}', 'Ver Actividades', true);"
                                title="Actividades"><img src="img/icons/doc.png"/></button>
                    @endif
                </td>
            </tr>
        @endforeach

If the column is used to show the buttons if it is an administrator, the buttons to edit your own records and those of others must be shown. If the supervisor is to show the buttons to edit the others' records and hide to edit their own records

The problem I have is that I want that if I enter with the supervisor "User Test" I should not show the buttons for that record but for the other records

The requirement is: The supervisor can edit or delete the records except their own records

    
asked by gmrYaeL 12.10.2018 в 21:50
source

1 answer

0

You have 3 roles, valid for admin with the if, so the "else" remains for supervisors and other people, you have to do an "else if" for them, if I understand your problem well

    
answered by 14.10.2018 / 04:09
source