laravel Views share Variable multiple to controller

Laravel Redirect To Another URL / Web Page - HTTP Laravel Redirects

Today, We want to share with you laravel Views share Variable multiple to controller.In this post we will show you how to pass data from one view to another view in laravel, hear for Sharing Data Between Views Using Laravel View Composers we will give you demo and example for implement.In this post, we will learn about Use Laravel View Composer to share data in partial views with an example.

laravel Views share Variable multiple to controller

There are the Following The simple About laravel Views share Variable multiple to controller Full Information With Example and source code.

As I will cover this Post with live Working example to develop Pass a variable on multiple views, so the How to share Variable with all Views in Laravel? for this example is following below.

Read Also:  Array push key value pair Dynamically in javascript

Step 1: Create a Laravel Route

First of all Lets us create two main Laravel routes:

# routes/web.php

Route::get('product', function () {
    return view('product');

Route::get('transaction', function () {
    return view('transaction');

Step 2: Create Blade View

Next, We have simple create two fresh views:


    <h1>product Page</h1>
    <p><?= $comman_data ?></p>


    <h1>Transaction Page</h1>
    <p><?= $comman_data ?></p>

Step 3: Share Variables


public function boot()
   // add this
    view()->share('comman_data', 'This is shared data');

Step 4: Testing


Web Programming Tutorials Example with Demo

Read :

Read Also:  How to pass data to all views in Laravel 5.8?


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about laravel Views share Variable multiple to controller.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

About Pakainfo

I am Jaydeep Gondaliya, a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Pakainfo →

Leave a Reply

Your email address will not be published. Required fields are marked *