Global Config variable In Laravel 6 Example

Today, We want to share with you Global Config variable In Laravel 6.In this post we will show you Laravel 6 global variable in all views file, hear for Creating Your Own PHP Helper Functions In Laravel 6 we will give you demo and example for implement.In this post, we will learn about Laravel Set and Get Global variables using controller with an example.

Global Config variable In Laravel 6

There are the Following The simple About Global data available to all controllers and models Full Information With Example and source code.

As I will cover this Post with live Working example to develop Define Global Variable in Laravel 6.2, so the How to set and get config variable in Laravel 6 is used for this example is following below.

How to set and get config variable in Laravel 6

global_data.php

return array(
 'movie_name' =>'Tamilrokers',
)

$cvalue = Config::get('global_data.movie_name');

Create Config File

config/global_data.php

<?php

return array(
    'movie_website' =>'BookMyShow',
    'movie_name' =>'Good Newwss',
);
?>

Use Constant Variable in Laravel 6

get the config in your laravel source code anywhere

echo  Config::get('global_data.movie_website');
echo  Config::get('global_data.movie_name')

Web Programming Tutorials Example with Demo

Read :

Summary

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

I hope you get an idea about Laravel define global constants Config php file.
I would like to have feedback on my infinityknow.com 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.