Qilinux Manicurist
Qilinux Manicurist

Reputation: 79

Namespacing not working in Laravel

Hello I do have a Model called 'Event'

/app/models/DC/Events/Event.php

<?php
namespace models\DC\Events;

class Event extends \Eloquent {

    protected $table = 'Events';

    protected $guarded = array('id', 'password_confirmation');
    protected $fillable = [
        'name', 
        'adress', 
        'zipcode', 
        'time', 
        'date', 
        'Fee', 
        'link', 
        'Description', 
        'country', 
        'city', 
        'fblink', 
        'lineup'
        ];
}

/app/controllers/EventController.php

<?php

use \models\DC\Events\Event as S;

class EventController extends \BaseController {


    /**
     * Display a listing of the resource.
     * GET /events
     *
     * @return Response
     */
    public function index()
    {
        $events = S::all();
        $events = S::paginate(5);
        return View::make('events.index');
    }
}

But it tells me "Class 'models\DC\Events\Event' not found"

Any suggestions on solving or is there be a better approach?

Upvotes: 1

Views: 42

Answers (1)

lukasgeiter
lukasgeiter

Reputation: 153150

In order to update the autload files that make sure you classes all get included you need to run

composer dump-autoload

Upvotes: 1

Related Questions