MNamazi
MNamazi

Reputation: 101

nWidart/laravel-modules How Use Config key modules in my view

I use nWidart/laravel-modules package, I need to use myModulesName Config keys in view. My config path : Modules\Tickets\Config\config.php and my config.php is:

<?php

return [
    'name' => 'Tickets',

    'status' => [
        '1' => 'باز',
        '2' => 'درحال بررسی',
        '3' => 'بسته شده'
    ],
    'color' => [
        '1' => 'label-danger',
        '2' => 'label-warning',
        '3' => 'label-success',
    ],
];

now, in my view, how I can use config keys?

Thank you

Upvotes: 2

Views: 1962

Answers (2)

OmidDarvishi
OmidDarvishi

Reputation: 650

return [
  'name' => 'Blog',
  'fa_name' => 'وبلاگ',
  'icon' => 'comment',
  'color1' => 'EF6F6C',
  'color2' => 'EF6F6C',
  'route' => 'blog',
  'disable' => false,

  'subs' => [
    ['name' => 'مطالب وبلاگ', 'route' => 'blog/list'],
    ['name' => 'دسته بندی ها', 'route' => 'category/list']
  ]
];

Upvotes: 1

Manzurul Hoque Rumi
Manzurul Hoque Rumi

Reputation: 3094

Add this config.php file to config folder with another name like tickets.php and get value like this:

{{ config('tickets.name') }}

Before that run this command php artisan config:cache

To use package which is in another folder Follow this

Upvotes: 0

Related Questions