in my laravel app I have to put the whole path of my file, like this:
$credentialsFilePath = "C:xampphtdocsmyapp.comjsonmyapp-dda63-firebase-adminsdk-a84ay-19eb8e8646.json"
However this doesn’t look so good to me, in production I will have to change the string path for it to work.
Is there a laravel method to do something like this:
absolutePath().'/json/myapp-dda63-firebase-adminsdk-a84ay-19eb8e8646.json'
2
Answers
In Laravel, you can use:
First of all, I suggest you to create a variable in
php
file within theconfig folder
and use that variable all over the applications.Declare variable and set default path in config variable for Firebase:
then use that variable using
config()
method all over the application. By using that syntax you can set variable value from.env
file for different servers i.e. staging, dev, prod