lundi 24 décembre 2018

How to call the constant declared inside private function?

I am trying to get the constant defined inside the helper file inside private function. My helper file is inside app\Helpers\Report\ . This is the code I tried. But I am getting error as:

Use of undefined constant CONDITION_A - assumed 'CONDITION_A' 

What I have done wrong?

ReportHelper.php

namespace App\Helpers\Report;

class ReportHelper 
{
    const CONDITION_A = "A";
    const CONDITION_B = "B";

    .....
}

MyController

<?php
namespace App\Http\Controllers;

use App\Helpers\Report\ReportHelper;

class MyController extends Controller
{
    private function _test() {
        echo ReportHelper::CONDITION_A;
    }
}



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2QLP0cK
via IFTTT

Aucun commentaire:

Enregistrer un commentaire