I am using scaffold command to generate code, but when i do scaffold for "event" everything go fines but when i try to load event controller in browser it shows following error Call to undefined method Illuminate\Support\Facades\Event::all()
My event controller code is
class EventsController extends BaseController {
protected $event;
public function __construct(Event $event)
{
$this->event = $event;
}
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$events = $this->event->all();
return View::make('events.index', compact('events'));
}
}
I din't understand why it throw error because its auto generated code, and i do 3 scaffold before this one and they are working well . may be i cant put the name "event" or "static" while generating scaffold. because when i generate scaffold for "static" also it give some kind of error and when i scaffold "staticcontent" its work well.
Note
By scaffold i mean scaffold command
php artisan generate:scaffold event --fields="from:date, body:text"