vendredi 30 juin 2017

Registering Controller in Service Provider in Laravel

I am getting the following error when I visit my localhost website http:\guam.dev\people

ReflectionException

Class Dashboard does not exist

This is my Directory structure.

laravel
-vendor
--student
---people
----composer.json
----src
-----PeopleServiceProvider.php
-----Controllers
------SuperAdmin
-------Dashboard.php
-----Routes
-----Views

This is my PeopleServiceProvider.php

namespace Student\People;

use Illuminate\Support\ServiceProvider;

class PeopleServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        include __DIR__ . '/Routes/routes.php';
        $this->loadViewsFrom(__DIR__.'/Views/SuperAdmin/Dashboard', 'People');
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->make('Student\People\Dashboard');
    }
}

Controller file : Dashboard.php

namespace Student\People;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class Dashboard extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        return view('app');
    }
}

What am I doing wrong ? I am following an old tutorial, but there isn't much explanation about controllers there.



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

Aucun commentaire:

Enregistrer un commentaire