Sunday, March 24, 2019

Laravel 5 Helper functions



Does anyone know where the source code is located for the built in Laravel 5 helper functions like view() and str_limit()? I am curious to see how they are doing things in the background.


Answer



view function is located under




/vendor/laravel/framework/source/illuminate/Foundation/helpers.php


line number 585



content is as follows:



if ( ! function_exists('view'))
{
/**

* Get the evaluated view contents for the given view.
*
* @param string $view
* @param array $data
* @param array $mergeData
* @return \Illuminate\View\View
*/
function view($view = null, $data = array(), $mergeData = array())
{
$factory = app('Illuminate\Contracts\View\Factory');


if (func_num_args() === 0)
{
return $factory;
}

return $factory->make($view, $data, $mergeData);
}
}



start using an IDE like Php storm and you can find all this functions with a single click


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...