laravel-share
laravel-share copied to clipboard
Blade statement doesn't render to html code
I create this variable on the controller:
$shareComponent = Share::page('http://jorenvanhocht.be') ->facebook() ->twitter() ->linkedin() ->reddit();
I send the $shareComponent to a view, and I tried the {!! $shareComponent !!} but instead of print it like this:
the output in the template is, literally a text:
laravel-share::laravel-share-fa5.facebooklaravel-share::laravel-share-fa5.twitterlaravel-share::laravel-share-fa5.linkedinlaravel-share::laravel-share-fa5.reddit
And no more, it doesn't show the icons or the urls, nothing.
How can I solve this problem? Its a issue?
This is what I have in my compose.json:
"require": { "php": "^8.0", "biscolab/laravel-recaptcha": "^5.0", "dbfx/laravel-strapi": "^1.0", "doctrine/dbal": "^3.1.1", "facade/ignition": "^2.3.6", "fideloper/proxy": "^4.0", "freshwork/chilean-bundle": "^2.1", "grkamil/laravel-telegram-logging": "^1.7", "guzzlehttp/guzzle": "^7.0.1", "jorenvanhocht/laravel-share": "^4.1", "laravel/framework": "^8.52.0", "laravel/tinker": "^2.6.1", "laravel/ui": "^3.0", "league/flysystem-aws-s3-v3": "~1.0", "malahierba-lab/chile-rut": "5.1.*", "mehradsadeghi/laravel-filter-querystring": "^1.1", "nunomaduro/collision": "^5.0", "phpunit/phpunit": "^9.0", "sentry/sentry-laravel": "^2.7", "spatie/laravel-markdown": "^2.1", "transbank/transbank-sdk": "^2.0", "vinkla/hashids": "^9.1", "zgabievi/promocodes": "^8.1" },
Same here:
<div id="social-links"><ul><li><a href="https://twitter.com/intent/tweet?text=Your+share+text+can+be+placed+here&url=http://jorenvanhocht.be" class="social-button " id="" title="" rel=""><span class="fab fa-twitter"></span></a></li></ul></div>
If you want just icons, add font-awesome library
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/css/all.min.css" />
If you also want to add text, change published vendor translation file
resources/lang/vendor/laravel-share/en/laravel-share-fa5.php
the output in the template is, literally a text:
laravel-share::laravel-share-fa5.facebooklaravel-share::laravel-share-fa5.twitterlaravel-share::laravel-share-fa5.linkedinlaravel-share::laravel-share-fa5.reddit
And no more, it doesn't show the icons or the urls, nothing.
It seems like you don't have the en
locale in your config settings. Under the hood this package uses trans() Laravel helper. Your output shows that it cannot find the substitution, so it returns the provided/given keys. Check your config/app.php
the locale
and fallback_locale
values. If they don't contain en
you need to publish the package config & resource files (see README.md) and then rename the folder resources/lang/vendor/laravel-share/en
to something else, according to your configuration.
Hope it will help :)