What are Closures in laravel ?

Written by Oscar

Posted On: Jan 11, 2019


    1 Answer Written

  •  Oscar
    Posted by Stacey

    A Closure is an anonymous function that often used as callback methods and can be used as a parameter in a function.

    Example of Laravel Closure

    User::with('profile', function ($builder) {
    	// Get me all collapsed comments
    	return $builder->whereCollapsed(true);

Please Login or Register to leave a response.

Related Questions