Helpers library

Note: this information is not available in the official docs, I found it by browsing through the source of laravel which I highly recomend for a better understanding of the framework.

The class is under laravel folder / helpers.php. I will not list all functions, only those I found very useful:

To retrieve a language line:

__($line);

To dump a value and exit:

dd($value);

To remove an array item with “dot” notation:

array_forget($array, 'user.data.name');

Convert an Eloquent model to JSON object:

eloquent_to_json($model);

Get the file size of a file in a human readable form (Bytes, KiB etc):

get_file_size($size);

And many more, feel free to explore, the library and the whole framework is very well commented.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s