dimanche 30 octobre 2016

Can't autoload a helper file - Laravel 5.3

I have a helper file located at

app/Helpers/Navigation.php

Helper file with namespace:

   <?php

namespace App\Helpers;

class Navigation
{
    public static function isActiveRoute($route, $output = 'active')
    {
        if (Route::currentRouteName() == $route) {
            return $output;
        }
    }
}

i wanted to autoload this file . So in my composer.json i have this:

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

In my view i want to do this:

<li class="">

But i get the error:

Call to undefined function isActiveRoute()

Not sure what i'm doing wrong. I did composer dumpautoload when i changed the composer file. I tried installing composer again, that also didn't change anything.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire