jeudi 29 septembre 2016

Call to undefined function - laravel

I want to use a helper functions but I got this error in my view :

Call to undefined function createSubCategories()

path of my helper functions:

Http\Controllers\Utilities\Helpers.php

my hlper :

<?php
namespace App\Http\Controllers\Utilities;


    function createSubCategories($parent_cat_id = 0)
    {

        $subs = DB::table('categories')->where('parent_cat_id', '=', $parent_cat_id)->get();
        if (count($subs) > 0) {
            echo '<ul>';
            foreach ($subs as $sub) {
                echo '<li>' . $sub->title_fa;
                echo $this->createSubCategories(($sub->id));
                echo '</li>';
            }
            echo '</ul>';
        }
    }

in composer.json :

"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/"
    },
    "files":
    [
        "app/Http/Controllers/Utilities/Helpers.php"
    ]
},

I used composer dump-autoload.

my view:





from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2cYYYjc
via IFTTT

Aucun commentaire:

Enregistrer un commentaire