laravel-share icon indicating copy to clipboard operation
laravel-share copied to clipboard

Blade statement doesn't render to html code

Open mgaratemu opened this issue 3 years ago • 3 comments

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" },

mgaratemu avatar Jan 13 '22 21:01 mgaratemu

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>

JD456976 avatar Jan 17 '22 22:01 JD456976

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

ap0ca avatar Jan 23 '22 23:01 ap0ca

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 :)

kudashevs avatar Jan 30 '22 22:01 kudashevs