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

Return object instead of array?

Open adamkearsley opened this issue 10 years ago • 1 comments

Not really an issue, but i personally think its cleaner to return objects in my views rather than arrays.

Add (object) to Share.php, Line 29:

return (object)$return;

Now i can use

$sharelink = Share::load(URL::to('someurlhere'), $something->title)->services('facebook', 'twitter');
$sharelink->facebook;
$sharelink->twitter;
...

Personal preference but imo looks cleaner in your view!

adamkearsley avatar May 12 '14 09:05 adamkearsley

Hi

I modified the method.

Just add true at the end.

$sharelink = Share::load(URL::to('someurlhere'), $something->title)->services('facebook', 'twitter', true);

thujohn avatar May 20 '14 17:05 thujohn