Reputation: 682
I'm using Laravel 5.7 and just got font awesome to work when putting icons staticly into my page, but when they're fetched there from an object they don't seem to work.
@extends('layouts.app')
@section('content')
{{$data['hosts'][0]->icon}}
<br>
<i class="far fa-question-circle"></i>
@endsection
Am I doing something wrong?
Upvotes: 0
Views: 171
Reputation: 778
I think your code is being escaped. As per Laravel's documentation, try using {!! !!} like:
@extends('layouts.app')
@section('content')
{!! $data['hosts'][0]->icon !!}
<br>
<i class="far fa-question-circle"></i>
@endsection
Upvotes: 2
Reputation: 9045
You are outputting HTML from the icon property, use this instead :
{!! data['hosts'][0]->icon !!}
{{ .. }} will treat everything inside it as string.
Upvotes: 1