I didn't deal with render method yet !!
is it for blade template ?
I have to pass dynamic data in blade.php file dynamically.
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.
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With