06.10.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Helper Functions 381<br />

1 $class = class_basename('Foo\Bar\Baz');<br />

2<br />

3 // Baz<br />

e() {#collection-method}<br />

The e function runs htmlentities over the given string:<br />

1 echo e('foo');<br />

2<br />

3 // &lt;html&gt;foo&lt;/html&gt;<br />

ends_with() {#collection-method}<br />

The ends_with function determines if the given string ends with the given value:<br />

1 $value = ends_with('This is my name', 'name');<br />

2<br />

3 // true<br />

snake_case() {#collection-method}<br />

The snake_case function converts the given string to snake_case:<br />

1 $snake = snake_case('fooBar');<br />

2<br />

3 // foo_bar<br />

str_limit() {#collection-method}<br />

The str_limit function limits the number of characters in a string. The function accepts a string as<br />

its first argument and the maximum number of resulting characters as its second argument:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!