mardi 22 septembre 2015

Laravel 5 can't reach custom class function

I have a question about Laravel 5. I made a new directory and file in the app directory.

App
    Helpers
        weather.php
    Http
        Controllers
            test.php

I want to access the function in weather.php but it doesn't work.

Weather.php

namespace App\Helpers

class Weather {

    public function test() {
        return "A";
    }
}

Test.php

namespace App\Http\Controllers;

class TestController extends Controller {

    public function bla() {
        return \App\Helpers\Weather\test();
    }
}

I get an error that the class is not found. Hope someone can help me because I don't know what is wrong.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire