2016-05-05 8 views
1

私はLaravelアプリケーションの認証にEntrustを使用しています。なぜ私は知らないのですが、ゲストとして私の公道にアクセスすることはできません。ルートログインページにリダイレクトLaravel 5.2

Route::get('/course-calendar', function() { 
    $events = \App\Models\Event::all(); 

    return view('public.calendar.index' , compact('events')); 
}); 

をしかし、私はこのようなルートを使用する場合:

このルートは宿泊客のために働いている

Route::resource('courses' , 'CourseController'); 

は、ログインページに私をリダイレクトします。これら二つの経路は、ここでroute.php

の一番上にある私のコントローラです:

<?php namespace App\Http\Controllers; 

use App\Models\Event; //models are at App\Models 

class CourseController extends Controller 
{ 

    //Show lists of the events in the calendar 
    public function dekha() 
    { 
     $events = Event::all(); 

     return view('public.calendar.index' , compact('events')); 
    } 

    //show single page 
    public function show($id) 
    { 
     $event = Event::find($id); 

     if (is_null($event)) 
     { 
      return Redirect::route('courses'); 
     }  

     return View::make('public.events.single', compact('event')); 
    } 

} 

奇妙なことのようです。私が紛失しているものを指摘していただけますか?

答えて

0

私はController.phpで愚かな間違いをしていました。

私はこれだった:私はcontroller.php

からのコードブロックを削除する必要がありました

public function __construct(){ 

    $this->middleware('auth'); 

}