Laravel Blade Include File With Data

Laravel 8 , Laravel 7 , Laravel , Laravel 6

Nicesnippets

3348

23-01-2021


Hi Guys,

In this blog, I will show you how to include file with data in laravel blade. We will talk about laravel blade include file with data example. I am going to learn you how to include file with data in blade in laravel application. We will show How to include blade with data in another file?. Let see example of How to include a view.blade.php file with data in Laravel

Even though the included view will inherit all data available in the parent view, you may also pass an array of additional data that should be made available to the included view:

Example


<!DOCTYPE html>

<html>

<head>

<title>Laravel Blade Include File with Data Example - NiceSnippets.com</title>

</head>

<body>

@include('example.index', ['status' => 'Include file successfully'])

</body>

</html>

Include File

resources/views/example/index.blade.php

<h1>{{ $status }}</h1>

It will help you....


Recommended Posts