1
votes

I added the following configurations at config/app.php file:

'STATUS' => [
    'PENDING' => ['LABEL'=>'Pending', 'VALUE'=>0],
    'PACKAGING' => ['LABEL'=>'Packing Done', 'VALUE'=>1],
    'PICKUP' => ['LABEL'=>'Assign to Pickup', 'VALUE'=>2],
    'REPICKUP' => ['LABEL'=>'Reassign to Pickup', 'VALUE'=>3],
    'PICKUPDONE' => ['LABEL'=>'Pickup Done', 'VALUE'=>4],
    'ASSIGNTODELEVER' => ['LABEL'=>'Assign to Deliver', 'VALUE'=> 5],
    'REASSIGNTODELEVER' => ['LABEL'=>'Reassign to Deliver', 'VALUE'=> 6],
    'DELIVERED' => ['LABEL'=>'Delivered', 'VALUE'=> 7],
    'PAID' => ['LABEL'=>'Paid to Merchant', 'VALUE'=> 8],
    'RETURNTOHUB' => ['LABEL'=>'Return to HUB', 'VALUE'=> 9],
    'RETURNTOMERCHANT' => ['LABEL'=>'Return to Merchant', 'VALUE'=> 10],
    'REFUSED' => ['LABEL'=>'Refused', 'VALUE'=> 100],
];

Now I want to access these data at onStart() function of layout/admin.htm file: function onStart()

{
    $this['STATUS']  = Config::get('app.STATUS'); 
}

But I am getting the following error:

Fatal error: Uncaught Error: Class 'Event' not found in E:\XAMMP\htdocs\myoctober\vendor\october\rain\src\Foundation\Exception\Handler.php:57 Stack trace: #0 E:\XAMMP\htdocs\myoctober\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(408): October\Rain\Foundation\Exception\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError)) #1 E:\XAMMP\htdocs\myoctober\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(116): Illuminate\Foundation\Http\Kernel->reportException(Object(Symfony\Component\Debug\Exception\FatalThrowableError)) #2 E:\XAMMP\htdocs\myoctober\index.php(43): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) #3 {main} thrown in E:\XAMMP\htdocs\myoctober\vendor\october\rain\src\Foundation\Exception\Handler.php on line 57

Is my approach wrong? Is there any smart way to set STATUS array which can be accessible through out the application?

1
I don't think this error is related to what you are trying to do. As regards accessing the Status data I think it would be more maintainable if you add it to your plugin's config file not the app.Raja Khoury

1 Answers

1
votes
{
    $this['STATUS']  = config('app.STATUS'); 
}

or

{
    $this['STATUS']  = \Config::get('app.STATUS');
}