<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
use App\Http\Controllers\HomeController;
Route::get('/', function () {
dd('Welcome to simple user route file.');
});
Auth::routes();
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
Route::get('helper', function () {
$googleAPIToken = config('google.api_token');
dd($googleAPIToken);
});
Laravel Add Custom Configuration File Example
you can easily create custom configuration file in laravel 6, laravel 7, laravel 8 and laravel 9 version.
in this example, we will create google.php config file and set api key on there. then we will simply get value using config() helper. let's see example.
Example
now first add your new variable on env file as like bellow:
By Hardik Savani April 10, 2021 Category : LaravelPlayUnmuteLoaded: 1.20%FullscreenNow, let's see article of laravel add custom configuration file. This article will give you simple example of laravel custom config file. we will help you to give example of laravel custom configuration file. you can see how to create custom config file in laravel. Let's get started with create your own config file laravel.