2015-10-15 123 views
1

我的谷歌字體設置,看起來像這樣的數組:在Laravel 5中應該在哪裏存儲配置值數組?

$googleFontList = array(
    'Abril Fatface' => array(
     'link_code' => 'Abril+Fatface', 
     'css_name' => 'Abril Fatface', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Archivo Narrow' => array(
     'link_code' => 'Archivo+Narrow:400italic,400,700italic,700', 
     'css_name' => 'Archivo Narrow', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Arvo' => array(
     'link_code' => 'Arvo:400italic,400,700italic,700', 
     'css_name' => 'Arvo', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Crete Round' => array(
     'link_code' => 'Crete+Round:400italic,400', 
     'css_name' => 'Crete Round', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Droid Serif' => array(
     'link_code' => 'Droid+Serif:400italic,400,700italic,700', 
     'css_name' => 'Droid Serif', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Josefin Slab' => array(
     'link_code' => 'Josefin+Slab:400,400italic,700,700italic', 
     'css_name' => 'Josefin Slab', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Lato' => array(
     'link_code' => 'Lato:400italic,400,700,700italic', 
     'css_name' => 'Lato', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Merriweather' => array(
     'link_code' => 'Merriweather:400italic,400,700italic,700', 
     'css_name' => 'Merriweather', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Open Sans' => array(
     'link_code' => 'Open+Sans:400,400italic,700italic,700', 
     'css_name' => 'Open Sans', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Oswald' => array(
     'link_code' => 'Oswald:400,700', 
     'css_name' => 'Oswald', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Roboto' => array(
     'link_code' => 'Roboto:400,400italic,700,700italic', 
     'css_name' => 'Roboto', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Roboto Condensed' => array(
     'link_code' => 'Roboto+Condensed:400,400italic,700,700italic', 
     'css_name' => 'Roboto Condensed', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Roboto Slab' => array(
     'link_code' => 'Roboto+Slab:400,400italic,700,700italic', 
     'css_name' => 'Roboto Slab', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Ubuntu' => array(
     'link_code' => 'Ubuntu:400,400italic,700,700italic', 
     'css_name' => 'Ubuntu', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
    'Varela Round' => array(
     'link_code' => 'Varela+Round', 
     'css_name' => 'Varela Round', 
     'normal_weight' => 400, 
     'bold_weight' => 700, 
    ), 
); 

我想避免放置該數組在多個不同的控制方法。我可以/應該把這樣的東西放在什麼地方,以便稍後可以將其稱爲控制器?這可以住在配置文件中嗎?

回答

4

您可以生成一個新的配置文件,例如: data.php在config文件夾。剛返回數組是這樣的:

<?php 

return [ 
    'key' => 'value', 
]; 

您可以通過

Config::get('data.key'); 
得到這個變量