jorenvh/laravel-share

Not working with me??

Closed this issue ยท 18 comments

I did everything like described in the doc but not working in the end it shows only

<div id="social-links"><ul>laravel-share::laravel-share-fa4.facebooklaravel-share::laravel-share-fa4.twitterlaravel-share::laravel-share-fa4.gpluslaravel-share::laravel-share-fa4.linkedin</ul></div>

https://laravel.com/docs/5.6/blade#displaying-data

Make sure to use {!! ... !!} instead of {{ ... }}

@jorenvh thanks
Here what I did

{!! Share::page( 'http://jorenvanhocht.be', 'Share title' )
		              ->facebook()
		              ->twitter()
		              ->googlePlus()
		              ->linkedin( 'Extra linkedin summary can be passed here' ) !!}

but still getting the same issue

in my phpstome I got this error too

Method __toString is not implemented for '\Share' less... (Ctrl+F1)
This inspection detects attempts to convert objects without __toString() method implementation to string, since PHP 5.2.0, it would cause E_RECOVERABLE_ERROR. "Check __toString exists for each expression type": if the option is on, the inspection will check all possible types of the expression and report if at least one ot them doesn't contain __toString() method implementation.

Did you:

  • Publish the package config & resource files?
  • Include font awesome in your project?
  • load the required js files?

It renders html so it seems to me that this is an issue in your view?

Can you show me a failing test?

Publish the package config & resource files? Yes
Include font awesome in your project? No
load the required js files? Yes

but I have the font awesome as CDN in my project any way to link the package to CDN

Using the CDN is just fine.

Did you specify the correct Font awesome version in the published config file?

yes I did I am using Font awesome version 4 and the package by default uses the same version

Can you run the tests and show me a failing test? This should just be working fine

Yes of course here you are

laravel-share::laravel-share-fa4.facebooklaravel-share::laravel-share-fa4.twitterlaravel-share::laravel-share-fa4.gpluslaravel-share::laravel-share-fa4.linkedin

that what I got when testing on the my blade

I'm referring to the unit tests of the package.

Sorry I didn't get that how should I do this? thanks for helping me out @jorenvh

In your cli navigate to

vendor/jorenvanhocht/laravel-share

and run the command phpunit

You mean cli this is the terminal so doing something like this?
C:\wamp64\www\order\vendor\jorenvanhocht\laravel-share>phpunit

Yep, as it is Windows you will probably have to run this in git bash or something similar.

Late, I'm afraid, but I found this very same problem and it was a silly one. Package takes HTML from lang file at resources/lang/vendor/laravel-share/en... If your locale is not 'en' it will show the very same code johnef wrote down. Just duplicate the 'en' folder, rename it to your current(s) locale(s) and you are good to go.

Thank You @kik-kolin,

After Publishing The Files. IF Your Project Support multilane.
You Should Support Other Langs, By Duplicating.
/resources/lang/vendor/laravel-share/en

after installation if you use another language such as persian, you must copy and rename folder en=>fa
this folder is in directory resources\lang\vendor\laravel-share

Thanks. where is file for version4 ??