nawshin.ahmed
nawshin.ahmed

Reputation: 19

How to set image url in anchor tag data value

I am working on a laravel project.My table shows some value and if i click eye icon to view then more details of that table shows in the modal.But i don't know how to pass the image source in anchor tag data value.

@foreach ($employees as $employee)
            <tr class="post{{$employee->id}}">
                <td>{{ $no++ }}</td>
                <td>{{ $employee->name}}</td>
                <td>{{ $employee->bank->name}}</td>
                <td>{{ $employee->bankbranch->location}}</td>
                <td><img alt="Smiley face" height="50" width="70" src="{{url('images',$employee->image)}}"/></td>
                <td>{{ $employee->created_at}}</td>
                <td>
                    <a href="#" class="show-modal btn btn-info btn-sm"  data-id="{{$employee->id}}" data-bank_id="{{$employee->bank->name}}" data-bankbranch_id="{{$employee->bankbranch->location}}" data-salary="{{$employee->salary}}" data-qincentive="{{$employee->qincentive}}" data-fbonus="{{$employee->fbonus}}" data-hrent="{{$employee->hrent}}" data-ename="{{$employee->ename}}" data-ephone="{{$employee->ephone}}" data-relationship="{{$employee->relationship}}" data-gender="{{$employee->gender}}" data-religion="{{$employee->religion}}" data-bgroup="{{$employee->bgroup}}" data-mstatus="{{$employee->mstatus}}"  data-transportallowance="{{$employee->transportallowance}}" data-eaddress="{{$employee->eaddress}}">
                        <i class="fa fa-eye"></i>
                </a>
                </td>
                </tr>
                @endforeach 

Upvotes: 0

Views: 99

Answers (1)

user5283119
user5283119

Reputation:

You just need to change your src to src=“{{$employee->image}}” providing the image url is stored in that variable. If not then you’ll need to do concatenation like src=“{{‘/images/’ . {{$employee->image}}”

Upvotes: 1

Related Questions