Is it right approach to write Laravel PHP code to give a role to hr to view certain column? Because after hosting the website stops automatically and start automatically. Code is working fine..
I am new to PHP, I have no idea if i am going wrong in this code can anyone help me out yrr...
<table class="table table-striped mb-0 dataTable">
<thead>
<tr>
@role('company')
<th>{{__('Employee Name')}}</th>
@endrole
@role('hr')
<th>{{__('Employee Name')}}</th>
@endrole
<th>{{__('Designation')}}</th>
<th>{{__('Promotion Title')}}</th>
<th>{{__('Promotion Date')}}</th>
<th>{{__('Description')}}</th>
@if(Gate::check('Edit Promotion') || Gate::check('Delete Promotion'))
<th width="200px">{{__('Action')}}</th>
@endif
</tr>
</thead>
<tbody class="font-style">
@foreach ($promotions as $promotion)
<tr>
@role('company')
<td>{{ !empty($promotion->employee())?$promotion->employee()->name:'' }}</td>
@endrole
@role('hr')
<td>{{ !empty($promotion->employee())?$promotion->employee()->name:'' }}</td>
@endrole
<td>{{ !empty($promotion->designation())?$promotion->designation()->name:'' }}</td>
<td>{{ $promotion->promotion_title }}</td>
<td>{{ \Auth::user()->dateFormat($promotion->promotion_date) }}</td>
<td>{{ $promotion->description }}</td>
@if(Gate::check('Edit Promotion') || Gate::check('Delete Promotion'))
<td>
@can('Edit Promotion')
<a href="#" data-url="{{ URL::to('promotion/'.$promotion->id.'/edit') }}" data-size="lg" data-ajax-popup="true" data-title="{{__('Edit Promotion')}}" class="edit-icon" data-toggle="tooltip" data-original-title="{{__('Edit')}}"><i class="fas fa-pencil-alt"></i></a>
@endcan
@can('Delete Promotion')
<a href="#" class="delete-icon" data-toggle="tooltip" data-original-title="{{__('Delete')}}" data-confirm="{{__('Are You Sure?').'|'.__('This action can not be undone. Do you want to continue?')}}" data-confirm-yes="document.getElementById('delete-form-{{$promotion->id}}').submit();"><i class="fas fa-trash"></i></a>
{!! Form::open(['method' => 'DELETE', 'route' => ['promotion.destroy', $promotion->id],'id'=>'delete-form-'.$promotion->id]) !!}
{!! Form::close() !!}
@endif
</td>
@endif
</tr>
@endforeach
</tbody>
</table>