use entry in laravel 5 .env file to set the index in algolia search

I am trying to figure out how to write my algolia search index, in my laravel .env file.

I have tried using public $indices = env('ALGOLIA'); But it doesn't work. i have of course written ALGOLIA=some_index in my .env file.

So how can i make $indices accept a environment variable?

Upvotes: 0

Views: 315

Answers (1)

cre8
cre8

Reputation: 13562

The .env variables just overwrite the config variables.

Declare your variable in a given config file or create a new one (Google for a new one). Then you can direct to the .environment file.

app.php

'algolia' => env('ALGOLIA')

.env

ALGOLIA=123

You then call it with Config::get('app.algolia');.

Upvotes: 2

Related Questions