Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is laravel render() method for?

Tags:

php

laravel

blade

I didn't deal with render method yet !!
is it for blade template ?
I have to pass dynamic data in blade.php file dynamically.

like image 999
hikefd Avatar asked Jun 12 '16 09:06

hikefd


People also ask

What is render in PHP?

Rendering HTML in PHP: HTML is the basis for creating any page and in many situations it is necessary to render it at runtime. This means that at any given time it needs to be written the extent to which the code is running.

What is @yield used for in Laravel?

In Laravel, @yield is principally used to define a section in a layout and is constantly used to get content from a child page unto a master page.

How do I return a view in Laravel?

Views may also be returned using the View facade: use Illuminate\Support\Facades\View; return View::make('greeting', ['name' => 'James']); As you can see, the first argument passed to the view helper corresponds to the name of the view file in the resources/views directory.

What is Blade template in Laravel?

Blade is the simple, yet powerful templating engine that is included with Laravel. Unlike some PHP templating engines, Blade does not restrict you from using plain PHP code in your templates.


1 Answers

Render(), when applied to a view, will generate the corresponding raw html and store the result in a variable.

Typical reasons for which I use render are:

When converting pages to pdf (ex. using dompdf, pass this into loadhtml()), returning HTML content to ajax calls

like image 143
Mizanur Rahman Avatar answered Oct 13 '22 17:10

Mizanur Rahman