Answers for "laravel define constants"

PHP
1

How to use my constants in Larvel

Create a file constants.php inside app/config/ and put your settings in an array:

<?php
//file : app/config/constants.php

return [
	'ADMIN_NAME' => 'administrator'
];

Then anywhere in your controllers or views you can get the value by using Config Facade:

echo Config::get('constants.ADMIN_NAME');
Posted by: Guest on April-28-2020
0

get constant in laravel

return [

   'ADMINEMAIL' => '[email protected]',

];

Now we can display with

Config::get('constants.ADMINEMAIL');
Posted by: Guest on November-05-2021

Browse Popular Code Answers by Language