2014-12-24 4 views
1

안녕 내가 할 '이벤트'는 Laravel 작동하지의 네임

/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'); 
    } 
} 

그러나 그것은 나를 알거나 해결에

어떤 제안이 "클래스를 찾을 수 없습니다 '모델은 DC \ 이벤트 \ 이벤트 \'" 더 나은 접근 방법이 될까요? 반드시 수업을 모두 만드는 autload 파일을 업데이트하기 위해

+0

당신이 문을 사용에 앞의 백 슬래시를 복용 시도 실행해야합니다 포함 얻을. – Jeff

답변

1

composer dump-autoload 
+0

나는 완전히 잊었다! 이것은 Undefined variable : 이벤트가 S :: all()에 할당되는 동안 이벤트를 반환하지만 트릭을 수행했습니다. –

+1

보기에 변수를 전달하는 것을 잊어 버린 것 같습니다. '보기 :: make ('events.index', array ('events'=> $ events '))' – lukasgeiter

+0

너는 내 날을 보냈다! View의 변수가 전달되어야하는지 알지 못했습니다. 우리가 모델에서 선언 했으므로 변수에 대해 이미 알았던 것으로 생각했습니다. –